Пример #1
0
 private static void Unhook(KeyBoardHook hook)
 {
     if (hook != null)
     {
         hook.UnHook();
         GC.Collect();
     }
 }
Пример #2
0
 void Unhook()
 {
     if (KeyBoarHook != null)
     {
         KeyBoarHook.UnHook();
         KeyBoarHook.OnKeyDownEvent -= KeyBoarHook_OnKeyDownEvent;
         GC.Collect();//增加GC防止窗体关闭后,钩子未被卸载.
     }
 }