DLL.DefineEnvironment Method

Applies to TestComplete 15.63, last modified on April 23, 2024

Description

The DLL.DefineEnvironment method defines a new environment for loading dynamic link libraries with the desired “bitness” and calling their routines. By defining an environment, the method also defines the “bitness” of the corresponding hosting process (tcHostingProcess.exe), into which TestComplete will load the libraries. Note that the DLL.DefineEnvironment method does not create the hosting process itself. The process with the specified “bitness” will be created later on demand (for instance, when you call the DLL.Load method).

Declaration

DLL.DefineEnvironment(IsX86)

IsX86 [in]    Optional    Boolean Default value: True   
Result The IDLLAccessProcess object

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

IsX86

Specifies whether a 32-bit or a 64-bit environment will be defined by the method. If the parameter is True (the default value), a 32-bit environment is defined and a 32-bit hosting process will be created later for loading DLLs. If the parameter is False, the method defines a 64-bit environment and a 64-bit hosting process will be created.

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 created environment.

Remarks

The maximum number of hosting processes (and corresponding environments) created by TestComplete for DLL loading 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 DefineEnvironment method twice or more times with the same parameter value (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

To view an example that demonstrates how to use the DefineEnvironment method, 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
DefineEnvironmentByDLL Method

Highlight search results