Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

intercepting keypresses even when the form does not have focus

Tags:

c#

.net

winforms

I've built a winforms application which checks for CTR+ALT+S and CTRL+ALT+E keypresses, using by overriding the ProcessCmdKey method. This works great, but if the screensaver goes on and then goes off the form doesn't have focus and the keypresses aren't intercepted. How can I receive these even if the form does not have focus?

like image 275
Jeremy Avatar asked Feb 16 '09 16:02

Jeremy


1 Answers

Alexander Werner has a "System Hotkey Component" project over at Code Project that wraps the RegisterHotkey() API into a user control that's really easy to implement.

like image 197
Adam Larsen Avatar answered Oct 05 '22 22:10

Adam Larsen