Question and Answer Database FAQ: FAQ4595C — Capturing the Active Window or Screen Category: Windows API Platform: All Windows Product: All, Question: How do I capture the active window or the entire screen? Answer: Use the Windows API function keybd_event(ByVal bVk, ByVal bScan, ByVal dwFlags, ByVal dwExtraInfo); Now give it the simulated keystrokes. keybd_event(0x2c,1,0,0); //simulate print-key down keybd_event(0x2c,0,2,0); //simulate print-key up This will give you the entire screen. keybd_event(0x2c,0,0,0); //simulate print-key down keybd_event(0x2c,0,2,0); //simulate print-key down This will give you the active window. Note: Under nt you must also simulate alt-key(0x12) to capture the active window. 8/4/99 11:59:26 AM
Last Modified: 01-SEP-99