[Collapse]TestComplete/viewarticle/63445/
 [Expand]General Information/viewarticle/63445/
 [Expand]Using Help System/viewarticle/55799/
 [Expand]Getting Started Tutorial/viewarticle/56246/
 [Collapse]Using TestComplete/viewarticle/57875/
  [Expand]TestComplete User Interface, Projects and Settings/viewarticle/57876/
  [Expand]Creating, Recording and Running Tests/viewarticle/56646/
  [Expand]Test Results/viewarticle/55010/
  [Collapse]Enhancing Tests/viewarticle/56964/
   [Expand]Parameterizing Tests/viewarticle/56865/
   [Expand]Running Tests on Multiple Operating Systems/viewarticle/62743/
   [Expand]Testing Applications in Low-Level Mode/viewarticle/55190/
   [Expand]Handling Events/viewarticle/56222/
   [Expand]Using Variables/viewarticle/56794/
   [Expand]User Forms/viewarticle/55164/
   [Expand]Working With Files and Databases/viewarticle/56877/
   [Collapse]Using External Functions/viewarticle/56836/
     Calling Functions From .NET Assemblies/viewarticle/55369/
     Calling Functions From Java Classes/viewarticle/55546/
    [Collapse]Calling DLL Functions From Tests/viewarticle/55565/
      Calling DLL Functions From Tests - Overview/viewarticle/55625/
      Calling DLL Functions From Tests - Required Plug-Ins/viewarticle/56833/
      Calling DLL Functions From Tests - Tutorial/viewarticle/56837/
      Specifics of Using 32- and 64-bit DLLs/viewarticle/56835/
      Calling DLL Functions From Keyword Tests/viewarticle/56834/
      Calling DLL Functions From Tests - Known Limitations/viewarticle/56827/
      Using Custom Data Structures in DLL Function Calls/viewarticle/56831/
      Using String Parameters in DLL Function Calls/viewarticle/55652/
      Using Arrays in DLL Function Calls/viewarticle/56830/
      Returning Strings and Interface References From DLL Functions/viewarticle/56829/
      Parameter Types for C++ Routines and Structures/viewarticle/56826/
      Parameter Types for Delphi Routines and Structures/viewarticle/56828/
     Calling Win32 API Functions/viewarticle/56859/
   [Expand]Using ActiveX Objects/viewarticle/55338/
   [Expand]Monitoring Performance/viewarticle/56380/
   [Expand]Tracing Exceptions, Crashes and Freezes in Tested Applications/viewarticle/56499/
   [Expand]Connected and Self-Testing Applications/viewarticle/56563/
   [Expand]Using Optical Character Recognition/viewarticle/55011/
   [Expand]Improving Object Recognition/viewarticle/56888/
    Integration With AQtime/viewarticle/55059/
    Using Environment Variables/viewarticle/64014/
    Working With Passwords and Other Sensitive Data/viewarticle/63995/
  [Expand]Teamwork and Integration Into QA Process/viewarticle/57266/
  [Expand]Extending TestComplete/viewarticle/57655/
  [Expand]Automating TestComplete/viewarticle/57438/
  [Expand]Best Practices/viewarticle/64008/
 [Expand]Testing Types/viewarticle/62721/
 [Expand]Applications Testing/viewarticle/62606/
 [Expand]Working With Application Objects and Controls/viewarticle/55815/
 [Expand]Samples and Tutorials/viewarticle/56239/
 [Expand]References/viewarticle/57878/
 [Expand]Other Tools That Help You Test Better/viewarticle/63442/
 [Expand]TestComplete 10 Licensing Guide/viewarticle/63451/
Updated: 7/15/2014 Applies To: TestComplete 10 Rating: No votes Click to rate: PoorNot badAverageGoodExcellent
Calling DLL Functions From Tests

Returning Interface References From DLL Functions

Functions located in dynamic link libraries may return an IDispatch, IUnknown or another interface reference as a result value. This topic describes some specifics of calling such functions from DLLs created with Visual C++ and Delphi.

Suppose, we have the following declarations of Visual C++ and Delphi functions that return an IDispatch reference value:

Visual C++

IDispatch __stdcall Test();

Delphi

function Test(): IDispatch; stdcall;

In the stdcall calling convention, the function’s result is passed via the CPU’s EAX register. However, Visual C++ and Delphi generate different binary code for these routines. Visual C++ stores the pointer to an IDispatch return value in the EAX register, as it is adopted in the stdcall convention. The specific of Delphi is that it returns the pointer to an IDispatch value via the stack.

TestComplete uses the same calling conventions as those adopted by Visual C++. So, you are able to call a C++ function declared in the described way from your scripts, but you are not able to call a Delphi routine that is declared as it was described above. To be able to obtain an IDispatch value from your Delphi routine, declare it in the following manner:

Delphi

procedure Test(var ResultObjRef : IDispatch); stdcall;

See also
Calling DLL Functions From Tests | Calling DLL Functions From Tests - Overview


© 2014 SmartBear Software. All rights reserved.
Email Send feedback on this document