|
|
|
|
|
- Overview
- Use
- Using a Visual Basic DLL
- Step 1: Saving the DLL
- Step 2: DLL declaration
- Step 3: Handling the DLL
- Step 4: Releasing the DLL
Calling a DLL written in Visual Basic
Visual Basic (like many other languages) allows you to create custom DLLs. WINDEV gives you the ability to use these DLLs from your applications. In most cases, a DLL written in Visual Basic is a class contained in a Visual Basic module and compiled as an ActiveX DLL. This class contains: - features (methods, functions, ...).
- members. In most cases, these members can be accessed via the serialization properties. Two types of properties are available:
- "Get" properties, used to retrieve the value of a member.
- "Set" or "Let" properties, used to assign a member (the type of the property that will be used depends on the type of the member).
Please note In a WINDEV application, these particular DLLs cannot be functions API or CallDLL32. Indeed, these DLLs do not comply with the WINAPI standard of Windows. These DLLs are used in the WINDEV projects as automation objects. For more details, see Automation objects. Using a Visual Basic DLL To use a DLL written in Visual Basic in a WINDEV project: - Register the DLL if necessary.
- Declare the DLL in a WLanguage process.
- Handle the DLL as an OLE object.
- Free the DLL.
Step 1: Saving the DLL If the DLL written in Visual Basic was developed: - on the computer running the WINDEV project: you don't need to register the DLL with Windows.
- on a different workstation from the one on which the WINDEV project is run: it is necessary to register the DLL with Windows by executing the command line "regsvr32 <NameOfTheDLL>".
Step 2: DLL declaration To use a DLL written in Visual Basic in your WINDEV project, this DLL must be declared in the process that uses it. This DLL must be declared as Automation object. For more details, see Automation object. <VariableName> is object OLE "<nameofVBproject>.<nameofVBmodule>" For example: MyVisualBasicDLL is object OLE "MyProject.MyModule"
Step 3: Handling the DLL The DLL can be handled like any Automation object (for more details, see Automation object). The calls to the methods and properties are performed as follows: Without parameter: [ReturnValue = ] VariableName>>Function() With parameters: [ReturnValue = ] VariableName>>Function(Parameter1 [,Parameters [,...]]) For example:
Value is string = MyVisualBasicDLL>>QueryUser()
MyVisualBasicDLL>>DisplayInfo("This is a test")
Step 4: Releasing the DLL This step is optional. Indeed, the DLL will be automatically freed when the application or the window that handles the DLL is closed. To free the DLL, use the following syntax:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|