private static IntPtr HookCallback( int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN && Hooker.callback != null) { int vkCode = Marshal.ReadInt32(lParam); Hooker.callback((Keys)vkCode); } return(CallNextHookEx(_hookID, nCode, wParam, lParam)); }
static void Main() { bool hooked = false; //if (!System.Diagnostics.Debugger.IsAttached) { Hooker.Init(); hooked = true; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new AudioStationRemote()); if (hooked) { Hooker.Dispose(); } }