>>>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.
>
>Hi Ed,
>
>Well, it'd be simpler to use the foxtools _WFindTitl() and _WhTohWnd() functions to retrieve the window handle, but then, how would you indicate that was the window to send to the clipboard? The bScan parameter? Hmm...might be worth a try. I'll post back later on this.
It'd take whatever window had focus; assuming that GetActiveWindow() grabs the VFP window, then GetWindow() would follow the behavior associated with GW_CHILD:
The retrieved handle identifies the child window at the top of the Z order, if the specified window is a parent window; otherwise, the retrieved handle is NULL. The function examines only child windows of the specified window. It does not examine descendant windows.It's a blind stab, and makes some tremendous assumptions about VFP's treatment of forms as direct child windows of GetActiveWindow(). But it's worth a shot if you haven't found something more promising...