This function returns the physical key state.
#define INCL_WININPUT /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwndDeskTop; /* Desktop-window handle. */ LONG sc; /* Hardware scan code. */ LONG lKeyState; /* Key state. */ lKeyState = WinGetPhysKeyState(hwndDeskTop, sc);