StringParameterMaxLength Property

Applies to TestComplete 14.60, last modified on April 22, 2021

Description

The IDLLAccessProcessOptions.StringParameterMaxLength property specifies the maximum length of a string that can be received by TestComplete from a DLL function via an out function parameter. If the length or the string returned from a DLL function via one of its out parameters exceeds the property’s value, TestComplete treats the returned parameter's value as a null string.

Usually, the caller of a DLL function determines the end of the returned string itself (for instance, by waiting for the termination null symbol that indicates the end of the string). The called DLL function may return through an out parameter a corrupted string with an incorrectly specified length or end. In this case, the caller of the function may receive a huge memory block until it finds the end of such a corrupted string. The StringParameterMaxLength property allows TestComplete to avoid receiving huge memory blocks with useless data when such a corrupted string is returned by a DLL function through its out parameter.

Declaration

IDLLAccessProcessOptionsObj.StringParameterMaxLength

Read-Write Property Unsigned integer
IDLLAccessProcessOptionsObj An expression, variable or parameter that specifies a reference to an IDLLAccessProcessOptions object

Applies To

The property is applied to the following object:

Property Value

The maximum length of a string that can be received by TestComplete via an out parameter from a DLL function. The default value is 1024.

Example

The code below changes the default value of the StringParameterMaxLength in the default environment for loading DLLs and then posts the new value of the setting to the test log.

JavaScript, JScript

function StringParameterMaxLengthExample()
{
  // Gets the Options object
  var opts = DLL.Options;
  // Sets the new value to the StringParameterMaxLength property
  opts.StringParameterMaxLength = 4096;
  // Posts the new StringParameterMaxLength value to the test log
  Log.Message(opts.StringParameterMaxLength);
}

Python

def StringParameterMaxLengthExample():
  # Gets the Options object
  opts = DLL.Options
  # Sets the new value to the StringParameterMaxLength property
  opts.StringParameterMaxLength = 4096
  # Posts the new StringParameterMaxLength value to the test log
  Log.Message(opts.StringParameterMaxLength)

VBScript

Sub StringParameterMaxLengthExample()
  ' Gets the Options object
  Set opts = DLL.Options
  ' Sets the new value to the StringParameterMaxLength property
  opts.StringParameterMaxLength = 4096
  ' Posts the new StringParameterMaxLength value to the test log
  Log.Message(opts.StringParameterMaxLength)
End Sub

DelphiScript

function StringParameterMaxLengthExample;
var opts;
begin
  // Gets the Options object
  opts := DLL.Options;
  // Sets the new value to the StringParameterMaxLength property
  opts.StringParameterMaxLength := 4096;
  // Posts the new StringParameterMaxLength value to the test log
  Log.Message(opts.StringParameterMaxLength);
end;

C++Script, C#Script

function StringParameterMaxLengthExample()
{
  // Gets the Options object
  var opts = DLL["Options"];
  // Sets the new value to the StringParameterMaxLength property
  opts["StringParameterMaxLength"] = 4096;
  // Posts the new StringParameterMaxLength value to the test log
  Log["Message"](opts["StringParameterMaxLength"]);
}

See Also

IDLLAccessProcessOptions Object
Using String Parameters in DLL Function Calls

Highlight search results