Monday, November 10, 2008

QTP API’s, DLL’s and more.

Using the Windows API
You can broaden testing abilities and include usability and flexibility to your tests and function libraries with the help of Windows API. A great number of functions are provided by Windows operating system to help you control and manage Windows operations. These functions can be used to achieve additional functionality.

To use Windows API functions:

1. In MSDN, locate the function you want to use in your test or function library.

2. Understand all the required parameters and return values of the function.

3. Note the location of the API function. API functions are located inside Windows DLLs. The name of the DLL in which the requested function is located is usually identical to the Import Library section in the function’s documentation. For example, if the documentation refers to User32.lib, the function is located in a DLL named User32.dll, typically located in your System32 library.

4. Use the QuickTest Extern object to declare (see more of this in examples) an external function.

5. Call the declared function, passing any required arguments.

DLL

A DLL (Dynamic Link Library) is a library containing code and data that can be used by more than one program at the same time. For Example

KERNEL32.DLL - Contains functions for file handles memory management, input/output operations, and interrupts.
COMDLG32.DLL - Controls the dialog boxes

DLLs save memory, encourage modularization of code, reduce swapping, save disk space, upgrade easier, provide a mechanism to extend the MFC library classes, support Multilanguage programs, and ease the creation of international versions.

Dynamic linking is a method that links applications to libraries at run time. DLLs may contain links to other DLLs. DLLs may have file extensions such as .EXE, .DRV, .DLL, .OCX etc

You can see DLL files on you system at C:\WINDOWS\system32 folder.

[Read and understand these examples thoroughly to get a better understanding]
Example 1 of QTP API
Example 2 of QTP API
Example 3 of QTP API

See how much you know about QTP API here

Subscribe to RSS Feed to stay in touch with the upcoming exciting stuff.