SRL Archive - C#/Visual Basic Help and Tutorials

Detecting Key Input [vb 2005]


~alex~

2007-06-26 12:09:03

I was wondering how you would detect key input when the application is not focused. KeyDown only works when it is focused.

Help appreciated.

!!1one!eleven1!

2007-06-26 20:24:58

I dont know the exact terminilogy but search for something like "Capture Windows Message Key Down"

Then you will find what im talking about, it captures windows messages, then you do a simple switch case select

something like

method that captures windows message(message msg)
{
switch msg
{
case F1
do stuff
exit

case F2
do stuff
exit
}
}

Hmm but then you would have to register global hotkeys.

Google RegisterHotKey user32.dll

That should set you in the right direction

~alex~

2007-06-27 04:28:03

Thanks for the help.

shaunthasheep

2007-06-27 08:02:35

The GetAsyncKeyState api may help you.

~alex~

2007-06-27 09:51:39

I'll look into it thanks.