Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Print Screen
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00164942
Message ID:
00171102
Views:
44
>>>About the best you can do is the active window (includes VFP desktop). Here's how:
>>>#define VK_SNAPSHOT 44
>>>DECLARE keybd_event IN Win32API;
>>>  SHORT bVk, SHORT bScan, INTEGER dwFlags, INTEGER deExtraInfo
>>>* Active Window
>>>= keybd_event(VK_SNAPSHOT, 0, 0, 0)
>>>* Windows desktop
>>>= keybd_event(VK_SNAPSHOT, 1, 0, 0)
>>>hth,
>>
>>Hi George,
>>
>>Do you know if there is some way use keybd_event to capture the active form? Using the 'Active Window' alternative above captures the main window of FoxPro.
>>
>>Thanks for sharing your knowledge...
>
>Hi Klas,
>
>If there is, I haven't found it. There's no reference to such in the SDK, so my reaction is that there isn't a way to do it without going through a number of API calls to get a device context, do a bit block transfer, and build the necessary structures to create a bitmap. Can it be done in pure VFP? Yes, but not as easily as the snippet above.

George and Klas,

I have a theory that you might want to try. If VFP is running, GetActiveWindow() returns the VFP main window. I haven't tried this, but GetWindow() might be able to return a handle to the active form -if- the active form were a real window (I don't think it is) and on top, and seen by Windows as a child window of VFP, by something like:

DECLARE INTEGER GetActiveWindow IN WIN32API
DECLARE INTEGER GetWindow IN WIN32API INTEGER HWND, INTEGER uCmd
#DEFINE GW_CHILD 5 &&See WINUSER.H
nHandleOfZOrderTop = GetWindow(GetActiveWindow(),GW_CHILD)

You could try passing that to keybd_event() as an experiment.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform