This function returns the state of the key at the time that the last message obtained from the queue was posted.
#define INCL_WININPUT /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwndDeskTop; /* Desktop-window handle. */ LONG vkey; /* Virtual key value. */ LONG lKeyState; /* Key state. */ lKeyState = WinGetKeyState(hwndDeskTop, vkey);