ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Miscellaneous WINDEV functions
  • 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
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Calling a DLL written in Visual Basic
Overview
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.
Use

Using a Visual Basic DLL

To use a DLL written in Visual Basic in a WINDEV project:
  1. Register the DLL if necessary.
  2. Declare the DLL in a WLanguage process.
  3. Handle the DLL as an OLE object.
  4. 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:
// Call to the QueryUser method 
Value is string = MyVisualBasicDLL>>QueryUser()

// Call to the DisplayInfo method 
MyVisualBasicDLL>>DisplayInfo("This is a test")

Step 4: Releasing the DLL

The DLL is freed like any Automation object, via the Delete keyword. For more details, see Automation object.
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:
delete <VariableName>
For example:
// Free the VB DLL
delete MyVisualBasicDLL
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 01/16/2025

Send a report | Local help