How can SilkTest call a DLL from 4Test?
Assume that there is a DLL named mynew.dll containing a function named MyFuncA that you wish to call from 4Test as a function named MyFunc.
The function takes a window handle and a string as arguments and returns a Boolean value.
This shows how to declare it in 4Test:
- Declare the DLL:
BOOL MyFunc (HWND hWnd, LPSTR sText) alias "MyFuncA"
- Use the function as you would with any other 4Test function:
Print (MyFunc (Desktop.hWnd, "My string"))
DLLs can also be used to add functionality that 4Test does not provide.
In the PageList class there is no way for SilkTest to determine how many rows there are in a PageList object or the RECT of an individual tab. However, there are functions available to do this in the Windows API.
Since the functions in the API use data types that 4Test does not support, you would need to create a DLL to make these calls and then return the required information back to 4Test in a data type that it can handle.
Attached below is the C++ source file required to implement this.