private static void InstallHook() { if (hhook == IntPtr.Zero) { SendKeysHookProc proc1 = new SendKeysHookProc(); hook = new System.Windows.Forms.NativeMethods.HookProc(proc1.Callback); stopHook = false; hhook = UnsafeNativeMethods.SetWindowsHookEx(1, hook, new HandleRef(null, UnsafeNativeMethods.GetModuleHandle(null)), 0); if (hhook == IntPtr.Zero) { throw new SecurityException(System.Windows.Forms.SR.GetString("SendKeysHookFailed")); } } }
private static void InstallHook() { if (hhook == IntPtr.Zero) { SendKeysHookProc proc1 = new SendKeysHookProc(); hook = new System.Windows.Forms.NativeMethods.HookProc(proc1.Callback); stopHook = false; hhook = UnsafeNativeMethods.SetWindowsHookEx(1, hook, new HandleRef(null, UnsafeNativeMethods.GetModuleHandle(null)), 0); if (hhook == IntPtr.Zero) { throw new SecurityException(System.Windows.Forms.SR.GetString("SendKeysHookFailed")); } } }