예제 #1
0
 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));
 }
예제 #2
0
        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();
            }
        }