How to do something when a hotkey is pressed?

I'm trying to build a program that listens to input even while not active/focused. I've chosen to do this using system-wide hotkeys, and I've registered one throught the RegisterHotkey function. But, since I am very much an amateur programmer, I can't really seem to figure out how I can actually do something when the key is pressed? Is there some function which gets called that I can overwrite? I'm not using the hWnd parameter, so I suppose I have to access the message queue somehow?

I would love it if it looked something like this

OnMessageRecievedInQue(Messag m){ if(m.key = hotkey.key){ DoStuff(); } } 

but obviously I would appreciate something slightly more complicated too 😉

by PineappleMechanic via /r/csharp

Leave a Reply