5

With the following RegisterHotKey function, I can globally hook normal key-modifier combinations:

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

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

But the question is, how do I hook Media Keys, those play/pause/next/previous -keys found in keyboards and pc remotes? I have googled and googled, but without any luck.

4

1 回答 1

3

对vk参数使用System.Windows.Forms.Keys.MediaPlayPause,System.Windows.Forms.Keys.Play等值(在将其转换为uint之后),对fsModifiers使用0(除非您想注册 Shift-Play、Alt-Play 或其他组合键)。

于 2014-09-20T18:44:10.230 回答