win12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
WinGetKeyState (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WININPUT
 
SHORT WinGetKeyState(hwndDesktop, vkey)
HWND hwndDesktop;    /* handle of the desktop */
SHORT vkey;          /* virtual key           */
 
The WinGetKeyState function returns the key state at the time the last
message from the queue was posted. This function is used to determine
whether a virtual key is up, down, or toggled.
 
This function can be used to obtain the state of the mouse buttons with the
VK_BUTTON1, VK_BUTTON2, and VK_BUTTON3 virtual-key codes.
 
Parameter    Description
────────────────────────────────────────────────────────────────────────────
 
hwndDesktop  Identifies the desktop window. This parameter can be
             HWND_DESKTOP or the desktop window handle.
 
vkey         Specifies the virtual-key value in the low byte and zero in the
             high byte.
 
Return Value
 
If the key is down, the 0x8000 bit is set (less than 0); if the key is up,
this bit is not set. If the key is toggled, the 0x0001 bit is set (a key is
toggled if it has been pressed an odd number of times since the system was
started).
 
See Also
 
WinGetPhysKeyState