How to implement Global Hotkeys in C#?
问题 I need to write an application which globally intercepts Alt+Shift+S. What I did is I created a DLL which sets global hooks: namespace Hotkeydll { public class MyHotKey { public static void setHooks() { KeyboardHookProcedure = new HookProc(KeyboardHookProc); hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProcedure, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0); } private int KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam) { //write something