예제 #1
0
 /// <summary>
 /// Detach the keyboard hook; call during shutdown to prevent calls as we unload
 /// </summary>
 private static void DetachKeyboardHook()
 {
     if (_hookID != IntPtr.Zero)
     {
         InterceptKeys.UnhookWindowsHookEx(_hookID);
     }
 }
예제 #2
0
 public App()
 {
     ShutdownMode = ShutdownMode.OnExplicitShutdown;
     try
     {
         _hookID = InterceptKeys.SetHook(_proc);
     }
     catch
     {
         if (_hookID != IntPtr.Zero)
         {
             InterceptKeys.UnhookWindowsHookEx(_hookID);
         }
     }
 }