Click to See Complete Forum and Search --> : show() via keybinds


Alpaca
October 30th, 2009, 12:07 AM
Hey, I'm making a small program that shows a small frame just under the mouse. What I want it to do is show the frame when I press a specific key combination, like Shift + tab or something. However, the program won't have any focus.

Any ideas on how to implement this?

vcdebugger
October 30th, 2009, 12:14 AM
try to handle for the key press events and show up your frame in the event handler delegates...

BigEd781
October 30th, 2009, 01:24 AM
try to handle for the key press events and show up your frame in the event handler delegates...

Keyboard events will not fire when the form does not have focus.

You can do this a couple of ways. You can register a hot key with the OS (some example code here (http://www.dotnet2themax.com/ShowContent.aspx?ID=103cca7a-0323-47eb-b210-c2bb7075ba78), or you can use a system hook. A system level keyboard hook can be a little tricky, but if you want to go that route search for documentation on the SetWindowsHookEx API.

Alpaca
October 30th, 2009, 09:21 AM
Thanks BigEd781, I'll take a look into those.