DLL.Load Method

Applies to TestComplete 15.46, last modified on January 09, 2023

Description

The DLL.Load method loads a particular dynamic link library in TestComplete and returns a pointer to the library. Later, this pointer can be used to call routines from the dll. Before you load a dll, you should define its type and type of its functions using the DLL.DefineDLL method and methods of the IDefineDLL object. DLL.Load "binds" these definitions with the actual library code. If the specified dll is not found, DLL.Load displays an error message.

Note: If you call DLL.Load twice or more times with the same input parameters, the method will load the dynamic link library only after the first call and will return pointers to the loaded library after subsequent calls. Thus, you can obtain a pointer to the loaded dynamic link library at any time later by calling DLL.Load once again with the same input parameters.

Declaration

DLL.Load(LibraryName, LibraryType)

LibraryName [in]    Required    String    
LibraryType [in]    Optional    String Default value: Empty string   
Result Pointer to the library

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

LibraryName

The file name, extension and absolute or relative path to the dynamic link library. If the file extension is omitted, Load uses .dll. If the path is not specified, the method searches for the dll in the following order:

  1. The folder, in which TestComplete is installed.
  2. The current working folder of the TestComplete process.
  3. The <Windows>\System32 (or the <Windows>\System) folder.
  4. The <Windows> folder.
  5. The folders specified in the PATH variable.
The WOW64 subsystem may redirect calls to some system libraries when you work with 32-bit applications. To load a library of a particular bitness, specify the full path to the required library.

LibraryType

The name of the dll type defined by the DLL.DefineDLL method. If it is omitted, TestComplete uses the dll file name as the dll type name (the file extension is excluded). For example, if you call the following code, TestComplete will use User32 as the dll type name.

JavaScript, JScript

Lib = DLL.Load("C:\\Windows\\System32\\User32.DLL");

Python

Lib = DLL.Load("C:\\Windows\\System32\\User32.DLL")

VBScript

Set Lib = DLL.Load("C:\Windows\System32\User32.DLL")

DelphiScript

Lib := DLL.Load('C:\Windows\System32\User32.DLL');

C++Script, C#Script

Lib = DLL["Load"]("C:\\Windows\\System32\\User32.DLL");

Result Value

A pointer to the specified dynamic link library.

See Also

Calling DLL Functions From Tests - Tutorial
IDefineDLL Object

Highlight search results