Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sending keystrokes to non VFP windows
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00158751
Message ID:
00159292
Views:
34
>>Is there any way to send keystrokes to other windows. I want to automate the filling in of several screens.Any ideas would be greatly appreciated.
>
>Here's how I send Ctrl+V to the active application from a C++ program:
>
> keybd_event(VK_CONTROL, 0, 0, 0);
> keybd_event('V', 0, 0, 0);
> keybd_event('V', 0, KEYEVENTF_KEYUP, 0);
> keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
>
>I won't bother posting the defines for VK_CONTROL, etc., since no doubt you'll have others you need. The point is that the process is rather low-level, to say the least: for each key, you have to send the keycode for the downstroke and the upstroke. Furthermore, giving any particular app the keyboard focus is not something I've been able to figure out how to do in Windows 98.

Hiya Mark,

I've never been able to get keybd_event to do this (properly) from VFP. I think the problem is that the first two parameters are defined as a BYTE, and there's no equivalent way (outside of STRING) to create such.

Have you tried SetFocus() in the API?
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform