Ejemplo n.º 1
0
 private void SafeRemove()
 {
     if (this.handle != IntPtr.Zero)
     {
         NativeExports.UnhookWindowsHookEx(this.handle);
         this.OnSuccessfullUnhook();
     }
 }
Ejemplo n.º 2
0
 public void RemoveHook()
 {
     if (this.State == HookState.Installed)
     {
         if (NativeExports.UnhookWindowsHookEx(this.handle))
         {
             this.OnSuccessfullUnhook();
         }
         else
         {
             var errorCode = NativeExports.GetLastError();
             throw new Exception(ErrorCodeHelper.GetMessage(errorCode));
         }
     }
 }