About Calling Functions from External Libraries - WinRunner

You can extend the power of your automated tests by calling functions from the Windows API or from any external DLL. For example, using functions in the Windows API you can:

  • Use a standard Windows message box in a test with the MessageBox function.
  • Send a WM (Windows Message) message to the application being tested with the SendMessage function.
  • Retrieve information about your application’s windows with the GetWindow function.
  • Integrate the system beep into tests with the MessageBeep function.
  • Run any windows program using ShellExecute, and define additional parameters such as the working directory and the window size.
  • Check the text color in a field in the application being tested with GetTextColor. This can be important when the text color indicates operation status.
  • Access the Windows clipboard using the GetClipboard functions.

You can call any function exported from a DLL with the _ _ stdcall calling convention. You can also load DLLs that are part of the application being tested in order to access its exported functions.

Using the load_dll function, you dynamically load the libraries containing the functions you need. Before you actually call the function, you must write an extern declaration so that the interpreter knows that the function resides in an external library.

Note:For information about specific Windows API functions, refer to your Windows API Reference. For examples of using the Windows API functions in WinRunner test scripts, refer to the read.me file in the \lib\win32api folder in the installation folder.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

WinRunner Topics