How to Use Dll Files in Our QTP Scripts: 1. Use the QuickTest Extern object to declare an external function. The following example declares a call to a function called GetForegroundWindow , located in user32.dll : extern.declare micHwnd, "GetForegroundWindow", "user32.dll", "GetForegroundWindow" 2. Call the declared function, passing any required arguments, for example: hwnd = extern.GetForegroundWindow(). In this example, the foreground window's handle is retrieved. You can enhance your function library if the foreground window is not in the object repository or cannot be determined beforehand (for example, a window with a dynamic title). You may want to use this handle as part of a programmatic description of the window, for example: Window("HWND:="&hWnd).Close Source: HP QTP help