home *** CD-ROM | disk | FTP | other *** search
- From: rhasty@dialnet.net
-
- #define INCL_WININPUT
- #define INCL_DOSPROCESS
- #include <OS2.H>
- #include <stdio.h>
- void main()
- {
- BOOL rc;
- BYTE KeyState[256]; /* This is a 256 byte table */
- /* indexed by virtual key */
- /* value. */
- /* For any virtual key, the */
- /* 0x80 bit is set if the key */
- /* is down, and zero if it is */
- /* up. The 0x01 bit is set */
- /* if the key is toggled, */
- /* (pressed an odd number */
- /* of times), otherwise it is */
- /* zero. */
-
- DosSetPriority( PRTYS_PROCESS, PRTYC_IDLETIME, 2,0);
- while(1)
- {
- rc=WinSetKeyboardStateTable(HWND_DESKTOP,
- /* the address of the second element is passed so that the */
- /* key number corresponds to the array index */
- &KeyState,
- FALSE); /* get a copy of the keyboard */
- /* state. */
- if(rc==FALSE)
- {
- WinAlarm(HWND_DESKTOP, WA_ERROR);
- return;
- }
- KeyState[VK_NUMLOCK] |= 0x01; /* set the NUMLOCK key to */
- /* on state */
- rc=WinSetKeyboardStateTable(HWND_DESKTOP,
- &KeyState,
- TRUE); /* set a copy of the keyboard */
- /* state. */
- DosSleep(5000);
- if(rc==FALSE)
- puts("Error Setting copy");
- } // While
- } // main
-