A declaration for a DLL begins with the keyword dll. The general format is:
dll dllname.dll prototype [prototype]...
where dllname is the name of the dll file that contains the functions you want to call from your 4Test scripts and prototype is a function prototype of a DLL function you want to call.
Environment variables in the DLL path are automatically resolved. You do not have to use double backslashes (\\) in the code, single backslashes (\) are sufficient.
The Open Agent supports calling both 32bit and 64bit DLLs. You can specify which type of DLL the Open Agent should call by using the SetDllCallPrecedence method of the AgentClass class. If you do not know if the DLL is a 32bit DLL or a 64bit DLL, use the GetDllCallPrecedence function of the AgentClass Class. The Classic Agent provides support for calling 32bit DLLs only.
return-type func-name ( [arg-list] )where:
[pass-mode] data-type identifierwhere:
To pass by value, make a function parameter an in parameter.
To pass by reference, use an out parameter if you only want to set the parameter’s value; use an inout parameter if you want to get the parameter’s value and have the function change the value and pass the new value out.
You can call DLL functions from 4Test scripts, but you cannot call member functions in a DLL.
The following example writes the text hello world! into a field by calling the SendMessage DLL function from the DLL user32.dll.
use "mswtype.inc" use "mswmsg32.inc" dll "user32.dll" inprocess ansicall INT SendMessage (HWND hWndParent, UINT msg, WPARAM wParam, LPARAM lParam) alias "SendMessageA" testcase SetTextViaDllCall() SendMessage(UntitledNotepad.TextField.GetHandle(), WM_SETTEXT, 0, "hello world! ")