 |
| Capturing keyboard activity of another application with the Raw Input API (VFP9) |
User rating: 0/10 (0 votes) | |
|
|
 |
 |
Versions: click to open |
 |
|
 |
 |
| Before you begin: |
 |
In this code sample, VFP form registers for receiving the raw input from each and any keyboard type device connected to the computer. That includes keyboards, numeric keypads, keyboard wedge scanners and so on.
The testing is simple. Any text typed in another Windows application (like text editor, spreadsheet, browser) will be duplicated in an EditBox on the VFP form.

Note that this code sample requires VFP9 version of the BINDEVENT() function. The one that can handle Windows messages.
See also:
LanguageBar ActiveX control
Enumerating raw input devices attached to the system
Switching between keyboard layouts
Disabling mouse and keyboard input for the main VFP window
How to disable the Windows Clipboard
|
 |
 |
| |
| |
Members area. Log in to view this example. |
|
| |
|
|
|
|
|
 |
User rating: 0/10 (0 votes) | |
| 7162 bytes Created: 2011-01-06 12:31:59 Modified: 2011-02-22 03:05:19 Visits in 7 days: 240 |
|
 |
 |
| Listed functions: |
 |
|
 |
 |
| My comment: |
 |
By default, no application receives raw input. For doing that, an application must register a device type it wants to get data from. When registered, an application receives the raw input through the WM_INPUT messages.
User input comes not just from keyboard and mouse, but also from a joystick, a touch screen, a microphone, and other devices collectively known as Human Interface Devices (HIDs).
Global keyboard and mouse hooks can produce similar results.
In case of multiple input devices of same type, the Raw Input API has means to separate the input (i.g. keystrokes, mouse events) by source.
* * *
Curiously: initially I chose registering keystrokes on KeyUps. And switched to KeyDowns after finding that fast typed keystrokes sometimes get released not in the sequence of pressing. |
 |
 |
| Word Index links for this example: |
 |
|
|
 |
 |
| Translate this page: |
 |
|