DLL.DefineEnvironmentByDLL Method

Applies to TestComplete 15.70, last modified on December 11, 2024

Description

The DLL.DefineEnvironmentByDLL method defines a new environment for loading dynamic link libraries and calling their routines. The “bitness” of the environment (32- or 64-bit) depends on the “bitness” of the library specified in the method’s DLLPath parameter. This library also defines the “bitness” of the corresponding hosting process (tcHostingProcess.exe), into which TestComplete will load libraries. Note that the DLL.DefineEnvironmentByDLL method does not create the hosting process itself. The process will be created later on demand (for instance, when you call the DLL.Load method).

Declaration

DLL.DefineEnvironmentByDLL(DLLPath)

DLLPath [in]    Required    String    
Result The IDLLAccessProcess object

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

DLLPath

The file name, extension and absolute or relative path to a dynamic link library whose “bitness” will be used as the “bitness” of the environment (and of the hosting process) to be created. If the file extension of the library is omitted, DefineEnvironmentByDLL 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.

Result Value

An IDLLAccessProcess object that provides methods for defining DLL types, loading DLLs in memory, defining new data types for routine parameters and creating new instances of these data types in the environment defined by the DLL.DefineEnvironmentByDLL method.

Remarks

The maximum number of hosting processes (and corresponding environments) created by TestComplete for loading DLLs is two (one 32-bit process for 32-bit libraries and one 64-bit process for 64-bit libraries). If you try to call the DefineEnvironmentByDLL method twice or more times specifying libraries with the same “bitness” (that is, if you try to define more than one environment with the same “bitness”), the method will not create a new environment and will return a reference to the same IDLLAccessProcess object created before. You can define only one 32-bit environment and only one 64-bit environment in one script.

Example

For an example of the DefineEnvironmentByDLL method’s use, see Specifics of Using 32- and 64-bit DLLs.

See Also

Specifics of Using 32- and 64-bit DLLs
Calling DLL Functions From Tests - Overview
Calling DLL Functions From Tests - Tutorial
DefineEnvironment Method

Highlight search results