Global keyhook for mediakeys in C #

With the following function, RegisterHotKey

I can globally connect the usual modifier key combinations:

private static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk);


Great article on this and full source code here:

But the question is, how can I connect Media Keys, those play / pause / next / previous buttons found in keyboards and remotes for PC? I have googled and googled but with no luck.


source to share

1 answer

Use values System.Windows.Forms.Keys.MediaPlayPause

, System.Windows.Forms.Keys.Play

etc. for the vk parameter (after clicking on uint ) and 0 for fsModifiers (unes that you want to register for Shift-Play, Alt-Play, or other key combinations).



All Articles