2 * Keyboard related functions
4 * Copyright 1993 Bob Amstadt
7 static char Copyright[] = "Copyright Bob Amstadt, 1993";
12 extern BOOL MouseButtonsStates[3];
13 extern BOOL AsyncMouseButtonsStates[3];
14 extern BYTE KeyStateTable[256];
16 /**********************************************************************
17 * GetKeyState [USER.106]
19 int GetKeyState(int keycode)
23 return MouseButtonsStates[0];
25 return MouseButtonsStates[1];
27 return MouseButtonsStates[2];
33 /**********************************************************************
34 * GetKeyboardState [USER.222]
36 void GetKeyboardState(BYTE FAR *lpKeyState)
38 if (lpKeyState != NULL) {
39 memcpy(lpKeyState, KeyStateTable, 256);
43 /**********************************************************************
45 * GetAsyncKeyState (USER.249)
47 * Determine if a key is or was pressed. retval has high-order
48 * byte set to 1 if currently pressed, low-order byte 1 if key has
51 * This uses the variable AsyncMouseButtonsStates (set in event.c)
52 * which have the mouse button number set to true if the mouse had been
53 * depressed since the last call to GetAsyncKeyState.
55 * There should also be some keyboard stuff here... it isn't here
58 int GetAsyncKeyState(int nKey)
65 retval = AsyncMouseButtonsStates[0] |
66 (MouseButtonsStates[0] << 8);
69 retval = AsyncMouseButtonsStates[1] |
70 (MouseButtonsStates[1] << 8);
73 retval = AsyncMouseButtonsStates[2] |
74 MouseButtonsStates[2] << 8;
81 bzero(AsyncMouseButtonsStates, 3); /* all states to false */