Page 1 of 1

Posted: Sat Aug 17, 2002 6:25 pm
by BackupUser
Restored from previous forum. Originally posted by cor.

How can I intercept keyboard input system wide?

Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com

Posted: Sun Aug 18, 2002 7:58 am
by BackupUser
Restored from previous forum. Originally posted by PB.

> How can I intercept keyboard input system wide?

For Windows, you can check the status of any key with the GetAsyncKeyState API.
All you need to know is the key code of the key to test. Take a look at my
example at this URL and you should be able to work it out:

viewtopic.php?t=1590


Note, however, that GetAsyncKeyState doesn't intercept the keypress... that is,
you can't use it to stop the keypress from happening -- it just tells you that
the key has (or has not) been pressed, on a system-wide basis.

PB - Registered PureBasic Coder


Edited by - PB on 18 August 2002 09:01:24

Posted: Sun Aug 18, 2002 11:02 am
by BackupUser
Restored from previous forum. Originally posted by freak.

There's a Function disabling all Input to the System, it's used like this:

Code: Select all

BlockInput_(#TRUE)    ; block Input

Sleep_(10000)         ; wait 10 sec.

BlockInput_(#FALSE)   ; enable Input
It disables Keyboard AND Mouse Input. Unfortunately, it is not implemented in
Windows 95 and not in Windows NT (3.1 and 4.0).

!!!! Warning !!!!
BE careful with this function! It stops all Input(it stops even the Mouse from moving). IF you for example put a MessageRequester() between those two commands,
your Program will totaly stop and wait for input, but since that isn't possible, you'll have to reboot!


That's it, hope it helps...

Timo

--------------------------------
Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs and the universe trying to produce bigger and better idiots.

...So far, the universe is winning.

Posted: Sun Aug 18, 2002 11:43 am
by BackupUser
Restored from previous forum. Originally posted by cor.

Thanks for the tips.

Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com