コード例 #1
0
        public IntPtr SetHook(LowLevelKeyboardProc proc)
        {
            _addKey = AddKeyPress;

            using (var currentProcess = Process.GetCurrentProcess())
            using (var currentModule = currentProcess.MainModule)
            {
                return SetWindowsHookEx(WhKeyboardLl, proc,
                    GetModuleHandle(currentModule.ModuleName), 0);
            }
        }
コード例 #2
0
        public IntPtr SetHook(LowLevelKeyboardProc proc)
        {
            timerKeySaver.Tick += timerKeySaver_Tick;
            timerKeySaver.Enabled = true;
            if (Application.OpenForms.Count > 0)
            {
                timerKeySaver.Interval = Form1.KeySaverTime;
                if (Form1.UseKeysaver)
                {
                    timerKeySaver.Enabled = true;
                    timerKeySaver.Start();
                }
            }

            addkey = AddKeyPress;

            using (Process curProcess = Process.GetCurrentProcess())
            using (ProcessModule curModule = curProcess.MainModule)
            {
                return SetWindowsHookEx(WH_KEYBOARD_LL, proc,
                    GetModuleHandle(curModule.ModuleName), 0);
            }
        }
コード例 #3
0
        public IntPtr SetHook(LowLevelKeyboardProc proc)
        {
            timerKeySaver.Tick   += timerKeySaver_Tick;
            timerKeySaver.Enabled = true;
            if (Application.OpenForms.Count > 0)
            {
                timerKeySaver.Interval = Form1.KeySaverTime * 1000;
                if (Form1.UseKeysaver)
                {
                    timerKeySaver.Enabled = true;
                    timerKeySaver.Start();
                }
            }

            addkey = AddKeyPress;

            using (Process curProcess = Process.GetCurrentProcess())
                using (ProcessModule curModule = curProcess.MainModule)
                {
                    return(SetWindowsHookEx(WH_KEYBOARD_LL, proc,
                                            GetModuleHandle(curModule.ModuleName), 0));
                }
        }