New Method

Applies to TestComplete 14.92, last modified on September 16, 2021

Description

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

Declaration

IDLLAccessProcessObj.New(TypeName, Count)

IDLLAccessProcessObj An expression, variable or parameter that specifies a reference to an IDLLAccessProcess object
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:

Parameters

The method has the following parameters:

TypeName

The name of the type. Before using it in IDLLAccessProcess.New, the name of the type must be registered in TestComplete by the IDLLAccessProcess.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.

Count

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.

Remarks

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.

Example

To view an example that demonstrates how to use the New method, see the Specifics of Using 32- and 64-bit DLLs help topic.

See Also

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

Highlight search results