Click to See Complete Forum and Search --> : exclusive keyboard control


Thomas Atwood
June 1st, 1999, 03:14 PM
does anyone know a way to gain exclusive control of the keyboard in a windows application?
Directinput allows you to do this for the mouse, but not the keyboard, (even after the keyboard is acquired with directinput it still generates WM_ messages, which i do not want it to do).

I've tried using the old dos methods of taking over the keyboard ISR, but microsoft has removed all access to the bios in visual c, so I had to go back and write the code in assembly. the getvect and setvect calls using INT 21h just lock the computer up...... and trying to change or even read the vector table directly [0000:9*4] generates an access violation (of course).

is there a way for me to do this? either prevent keyboard messages from being sent while i'm using directinput, or a way I could make my own lowlevel access to the keyboard without crashing windows?

B. Colombet
June 2nd, 1999, 08:22 AM
Try to intercept all keyboard messages :
KEYDOWN, KEYUP

MSG msg;

::PeekMessage(&msg, WM_KEYDOWN, PM_REMOVE)
I don't remember the exact parameters.
Try use this method in a loop and remove messages.

If a key was pressed you can get it in msg.wParam

Hope it helps

C++ developer
Faculté de Médecine
27 Bd Jean Moulin
13385 Marseille cedex 05

ericpan
June 2nd, 1999, 10:24 AM
You can try keyboard Hook.A hook installed in DLL can receive and block all keyboard input.