Capture multimedia keys when the application is minimized

I want to provide an option for the media player I'm working on so that the media keys work even when they are minimized. What is the best way to capture and handle these key events in C # without focus? Is it possible?

+8
c # keyboard media
source share
4 answers

I don't think there is an easy way to do this, but this (Using Window messages to implement global system clicks in C #) may help. I added the code below

_GlobalHooks.Keyboard.KeyboardEvent += (w, l) => { this.LblMouse.Text = "KEY: " + w.ToInt32().ToString("X8") + " " + l.ToInt32().ToString("X8"); }; _GlobalHooks.Keyboard.Start(); 

for Form1 constructor GlobalHookTest and was able to track all keyboard events.

+6
source share

You can do this, but only with some global binding - for source code and details see

EDIT:

Beware that some Media Keys are translated into Windows APP_COMMAND messages, so you should consider connecting them too.

IF you want your media planner to automatically start by pressing the (media) key, see the links here .

+3
source share

Using global keyboard hooks ( Processing global mice and keyboard hooks in C # )

Just create a hook when starting the application / form. You can set KeyEventHandlers for global keystroke, down and click events. Then you can check if this is the key combination you are looking for.

+1
source share

For this problem, I implemented this solution:

http://blogs.msdn.com/b/toub/archive/2006/05/03/589423.aspx

0
source share

All Articles