private UnhookWindowsHookEx ( IntPtr hhk ) : bool | ||
hhk | IntPtr | |
Результат | bool |
/// <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); } }
public static void Run() { InterceptKeys.callback = new InterceptKeys.CallBack(MySelector); InterceptKeys._hookID = InterceptKeys.SetHook(InterceptKeys._proc); Application.Run(); InterceptKeys.UnhookWindowsHookEx(InterceptKeys._hookID); }
private void F_accueil_FormClosing(object sender, FormClosingEventArgs e) { if (to_be_saved == true && Is_Closing == false) { MessageBoxButtons buttons = MessageBoxButtons.YesNoCancel; DialogResult result = MessageBox.Show("Voulez-vous sauvegarder la proposition sous excel ?", "", buttons); if (result == DialogResult.Yes) { closing = e; Is_Closing = true; } else if (result == DialogResult.No) { //Program.Connection_COQUE.close_COQUE(); InterceptKeys.UnhookWindowsHookEx(InterceptKeys.Key_hookID); InterceptKeys.UnhookWindowsHookEx(InterceptKeys.Click_hookID); //fEnvoiMail(); to_be_saved = false; Application.Exit(); } else if (result == DialogResult.Cancel) { e.Cancel = true; } } else { InterceptKeys.UnhookWindowsHookEx(InterceptKeys.Key_hookID); InterceptKeys.UnhookWindowsHookEx(InterceptKeys.Click_hookID); //fEnvoiMail(); Application.Exit(); } }
public void Dispose() { InterceptKeys.UnhookWindowsHookEx(hookId); }
static KeyboardHook() { IntPtr hookId = InterceptKeys.SetHook(_handler); AppDomain.CurrentDomain.ProcessExit += (s, e) => InterceptKeys.UnhookWindowsHookEx(hookId); }