How can I make my Windows Forms application 'listen' for global key presses?

[亡魂溺海] 提交于 2019-12-19 09:07:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!