hamze torabzade
hamze torabzade

Reputation: 7331

get pressed keys when my program is not on top off all open applications

just like some dictionary software that when you select a word and press a shortcut key, software will be shown and in this case translate the word, I'd like to fire an event when my App is open and one special key is pressed. for more info on what exactly want to do : I want to get a number after an special key Like 'PageDown' pressed (user press 'PageDown' then enter his number then press 'PageDown' again) and do some works with that number. I don't want my App come on top of all other applications, actually I want do all this silently. sample code will be appreciated

Upvotes: 0

Views: 379

Answers (1)

coolmine
coolmine

Reputation: 4463

If you are looking to only handle 1-2 keys then it might not be a bad idea to look into windows RegisterHotKey function. But in case you want to handle more keys than that you will probably be better of with a global keyboard hook.

If you are interested for just 1-2 keys then you can find an example on how to implement RegisterHotKey at How to register a global hotkey for your application in C#

Upvotes: 1

Related Questions