Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
 private static extern int SetWindowsHookEx(int idHook, LowLevelKeyboardDelegate lpfn,
         int hmod, int dwThreadId);
Esempio n. 3
0
 internal static extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardDelegate lpfn, IntPtr hMod, uint dwThreadId);