Example #1
0
 private static void EnsureSubscribedToGlobalKeyboardEvents()
 {
     if (HookManager.s_KeyboardHookHandle != 0)
     {
         return;
     }
     HookManager.s_KeyboardDelegate   = new HookManager.HookProc(HookManager.KeyboardHookProc);
     HookManager.s_KeyboardHookHandle = HookManager.SetWindowsHookEx(13, HookManager.s_KeyboardDelegate, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0);
     if (HookManager.s_KeyboardHookHandle == 0)
     {
         throw new Win32Exception(Marshal.GetLastWin32Error());
     }
 }
Example #2
0
        private static void ForceUnsunscribeFromGlobalKeyboardEvents()
        {
            if (HookManager.s_KeyboardHookHandle == 0)
            {
                return;
            }
            int num = HookManager.UnhookWindowsHookEx(HookManager.s_KeyboardHookHandle);

            HookManager.s_KeyboardHookHandle = 0;
            HookManager.s_KeyboardDelegate   = (HookManager.HookProc)null;
            if (num == 0)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }
        }
Example #3
0
 private static extern int SetWindowsHookEx(
     int idHook,
     HookManager.HookProc lpfn,
     IntPtr hMod,
     int dwThreadId);
Example #4
0
 private static void ForceUnsunscribeFromGlobalMouseEvents()
 {
     if (HookManager.s_MouseHookHandle != 0)
     {
         int num = HookManager.UnhookWindowsHookEx(HookManager.s_MouseHookHandle);
         HookManager.s_MouseHookHandle = 0;
         HookManager.s_MouseDelegate = null;
         if (num == 0)
         {
             int lastWin32Error = Marshal.GetLastWin32Error();
             throw new Win32Exception(lastWin32Error);
         }
     }
 }
Example #5
0
 private static void EnsureSubscribedToGlobalMouseEvents()
 {
     if (HookManager.s_MouseHookHandle == 0)
     {
         HookManager.s_MouseDelegate = new HookManager.HookProc(HookManager.MouseHookProc);
         HookManager.s_MouseHookHandle = HookManager.SetWindowsHookEx(14, HookManager.s_MouseDelegate, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0);
         if (HookManager.s_MouseHookHandle == 0)
         {
             int lastWin32Error = Marshal.GetLastWin32Error();
             throw new Win32Exception(lastWin32Error);
         }
     }
 }