DLL.New Method

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


The DLL.New method creates a new variable of the specified type and returns this variable.


DLL.New(TypeName, Count)

TypeName [in]    Required    String    
Count [in]    Optional    Integer Default value: 1   
Result Object of the specified type

Applies To

The method is applied to the following object:


The method has the following parameters:


The name of the type. Before using it in DLL.New, the name of the type must be registered in TestComplete by the DLL.DefineType method.

There are two predefined TypeNames: LPSTR and LPWSTR. They are used to create strings to be passed to functions. For more information, see Calling DLL Functions From Tests - Tutorial.


The number of the elements to be created. By default, it is 1, which means that you are creating one instance of the specified type. If Count is greater than 1, it means that you are creating an array of elements of the specified type.

For a variable of the LPSTR or LPWSTR type, the Count parameter specifies the maximum number of characters that can be contained in the string to be created.

See Using Arrays in DLL Function Calls and Calling DLL Functions From Tests - Tutorial for more information.

Result Value

A variable of the specified type.


The New method fills the memory allocated for the variable with zeros. So, if you create an LPSTR or LPWSTR variable, it will refer to a null string. If you create a structure, the structure will be filled with zeros.


To view an example that demonstrates how to use the New method, see Using Arrays in DLL Function Calls.

See Also

Calling DLL Functions From Tests - Tutorial

Highlight search results