问题
I'm making a little application for taking notes. So when I type 'note' anywhere on my computer, my window will pop up and show me a textbox for me to type something in and save it to XML.
I'm stumped on how to get the program to 'listen' to my keypresses. I'll have the app running on the system tray if that's any help. :)
回答1:
Take a look at http://www.codeproject.com/KB/cs/globalhook.aspx
Besides this question has been asked around in SO already. Take a look at here:
Global Keyboard Hooks (C#)
Global keyboard capture in C# application
Best way to tackle global hotkey processing in c#?
来源:https://stackoverflow.com/questions/2726389/how-can-i-make-my-windows-forms-application-listen-for-global-key-presses