Application-only Keyhook

james2k2
08-18-2009, 05:51 AM
Hi All,
I'm building an application which requires a method to accept key presses no matter what control has focus. A work around i'm using at the moment is to use a timer to give focus to the form every second although i'm not sure how this would affect button presses. Are there any better methods?

Many thanks,
James

james2k2
08-18-2009, 06:26 AM
Actually, tell a lie. I can't even get it to SetFocus on a timer event. Any ideas?

Thanks.

some1uk03
08-19-2009, 02:53 PM
You will need to subclass your form, then no matter what, it will detect your key presses.


Have a read through here: (http://vbnet.mvps.org/index.html?code/hooks/lowlevelkeyboardproc.htm)

or

search for subclassing methods.

Cerian Knight
08-19-2009, 03:44 PM
Have you tried {FormName}.KeyPreview = True and using the forms KeyUp/Down/Press events? Or when you say 'no matter what control has focus', do you mean 'no matter what application has focus'?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum