문제

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