示例#1
0
文件: KeyHook.cs 项目: CLUEit/CLUEit
        public static bool RegisterHook()
        {
            lock (Lock)
            {
                if (IsRegistered)
                    return true;
                Delegate = LowLevelKeyboardHandler;
                Hook = SetWindowsHookEx(
                        WH_KEYBOARD_LL, Delegate,
                        Marshal.GetHINSTANCE(
                                System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0]
                        ).ToInt32(), 0
                );

                if (Hook != 0)
                    return IsRegistered = true;
                Delegate = null;
                return false;
            }
        }
示例#2
0
文件: KeyHook.cs 项目: CLUEit/CLUEit
 private static extern int SetWindowsHookEx(int idHook, LowLevelKeyboardDelegate lpfn,
         int hmod, int dwThreadId);
示例#3
0
 internal static extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardDelegate lpfn, IntPtr hMod, uint dwThreadId);