Since DLL functions are written in C, the arguments you pass to these functions must have the appropriate C data types. In addition to the standard 4Test data types, Silk Test Classic also supports the following C data types:
The char* data type in C is represented by the 4Test STRING data type. The default string size is 256 bytes.
The following code fragments show how a char array declared in a C struct is declared as a STRING variable in a 4Test record:
// C declaration typedef struct { ... char szName[32]; ... } // 4Test declaration type REC is record ... STRING sName, size=32 ...
my_parameter = space(1000)
If the user calls a DLL function with an output string buffer that is less then the minimum size of 256 characters, the original string buffer is resized to 256 characters and a warning is printed. This warning, String buffer size was increased from x to 256 characters (where x is the length of the given string plus one) alerts the user to a potential problem where the buffer used might be shorter than necessary.
When passing pointers to C functions, use these conventions:
An argument whose value will be modified by a DLL function needs to be declared using the out keyword. If an argument is sometimes modified and sometimes not modified, then declare the argument as in and then, in the actual call to the DLL, preface the argument with the out keyword, enclosed in brackets.
For example, the third argument (lParam) to the SendMessage DLL function can be either in or out. Therefore, it is declared as follows:
// the lParam argument is by default an in argument dll "user.dll" LRESULT SendMessage (HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
SendMessage (Open.hWnd, WM_GETTEXT, 256, [out] sText)
If a parameter takes a window handle, use the hwnd property or the GetHandle method of the AnyWin class to get the window handle you need.