DebugAgent.TreatStdCallAsSafeCall Method

Applies to TestComplete 15.40, last modified on July 05, 2022

Description

If the tested application is an Open Application that is compiled with debug information, TestComplete has access to the application’s internal methods, properties and objects. Some methods may be defined as methods using the stdcall calling convention and some methods can be defined as methods using the safecall convention. The debug information generated by some compilers (for instance, by Delphi) may report safecall methods as stdcall. So, calling these methods from TestComplete may cause an error (you will see the error message in the test log).

Using the TreatStdCallAsSafeCall method, you can specify whether TestComplete should treat stdcall methods as safecall. This will guarantee the correct processing of a method call and will help you avoid the error.

Declaration

DebugAgent.TreatStdCallAsSafeCall(Enabled)

Enabled [in]    Required    Boolean    
Result None

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

Enabled

Specifies whether the stdcall methods will be called using the safecall convention.

Result Value

None.

Remarks

Settings made by a call to the TreatStdCallAsSafeCall method effect it until you call a method with another value. Typically, you only need to activate the “stdcall-as-safecall” processing mode for a single method call and then restore the default mode by passing False to the TreatStdCallAsSafeCall method.

Example

The code below calls the TreatStdCallAsSafeCall method to treat all the ensuing stdcall methods as safecall methods. At the end of the test run, the routine disables this feature by calling the method with its parameter value set to False.

JavaScript, JScript

function DebugAgentExample()
{
  // Enables the feature
  DebugAgent.TreatStdCallAsSafeCall(true);
   
  // ...
  // All the stdcall methods are treated as safecall methods
  // ...
  
  // Disables the feature
  DebugAgent.TreatStdCallAsSafeCall(false);
  
}

Python

def DebugAgentExample():
  # Enables the feature
  DebugAgent.TreatStdCallAsSafeCall(True)
  # ...
  # All the stdcall methods are treated as safecall methods
  # ...
  # Disables the feature
  DebugAgent.TreatStdCallAsSafeCall(False)

VBScript

Sub DebugAgentExample

  ' Enables the feature
  DebugAgent.TreatStdCallAsSafeCall(True)
   
  ' ...
  ' All the stdcall methods are treated as safecall methods
  ' ...
  
  ' Disables the feature
  DebugAgent.TreatStdCallAsSafeCall(False)
  
End Sub

DelphiScript

function DebugAgentExample;
begin

  // Enables the feature
  DebugAgent.TreatStdCallAsSafeCall(true);
   
  // ...
  // All the stdcall methods are treated as safecall methods
  // ...
  
  // Disables the feature
  DebugAgent.TreatStdCallAsSafeCall(false);
  
end;

C++Script, C#Script

function DebugAgentExample()
{
  // Enables the feature
  DebugAgent["TreatStdCallAsSafeCall"]( true );
   
  // ...
  // All the stdcall methods are treated as safecall methods
  // ...
  
  // Disables the feature
  DebugAgent["TreatStdCallAsSafeCall"]( false );
  
}

See Also

About Open Applications
Debug Info Agent
Calling Methods and Properties of Open Applications' Objects

Highlight search results