To capture a bitmap image of an object or window from within the script, use the CaptureBitmap method.
Object.CaptureBitmap FileName, [OverrideExisting]
Where Object is an QuickTest Professional object class.
OverrideExisting is a boolean value indicating whether the captured image should be overwritten if the image file already exists in the test results folder. (Default: False)
By default, if an image with the specified file name already exists in the folder, this method does not overwrite the existing file. You can set the OverrideExisting argument to True to instruct QuickTest Professional to overwrite an existing image with the same file name. You can also specify the file as a relative path so that the file will automatically be saved to a different folder in each test run.
Dialog("Login").WinEdit("Agent Name:").Set "mercury"
' Capturing a bitmap of the entire window
' Capturing a bitmap of the Agent Name edit field
After running the above code inside QTP or in a function library associated, you would find two bitmap images in the C:\Temp directory. Bitmap.bmp will contain the screenshot of the entire Login window. Bitmap2.bmp contains ascreenshot of the Agent Name edit field.
If you find that this or any post resolves your issue, mark it as an accepted solution.
Note: The Opinions expressed in my post are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any answerd posted."