سؤال

Im building a small application for my employer where hitting a certain keystroke will display a model box containing information that one of our technicians would require when providing one to one support.

its a very simple application but tracking the keyboard events without causing any issues for the user is puzzling me.

Basically I need to write a class that I can rely on to send me an event when CTRLALT + H are fired.

what's the best methods of completing this without having tons of events fired through my application, for example, ask windows to inform me when the keystroke has been entered.

Regards.

هل كانت مفيدة؟

المحلول

Use a global hotkey. The link contains a class that encapsulates the P/Invoke stuff required to use global hotkeys in .NET.

نصائح أخرى

Take a look at ( http://www.codeproject.com/kb/cs/globalhook.aspx ) for the Keyboard hook and then at where they show you how to listen for specific combinations ( http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/2b91129c-bcc4-4cd7-bf6b-25fb10629b8a ).

Hope that helps...

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top