Global keyhook for mediakeys in C #

With the following function, RegisterHotKey

I can globally connect the usual modifier key combinations:

[DllImport("user32.dll")]
private static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk);

      

Great article on this and full source code here: http://www.liensberger.it/web/blog/?p=207

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.

+3


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).



+2


source







All Articles