コード例 #1
0
 private static IntPtr HookKeyboardCallBack(
     int nCode, IntPtr wParam, IntPtr lParam)
 {
     if (nCode >= 0)
     {
         KBDLLHOOKSTRUCT hookStruct = Marshal.PtrToStructure <KBDLLHOOKSTRUCT>(lParam);
         KeyBoardAction?.Invoke((EventMessage)wParam, hookStruct);
     }
     return(CallNextHookEx(_hookID, nCode, wParam, lParam));
 }
コード例 #2
0
ファイル: Utilities.cs プロジェクト: zadop/LogOut
        private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
            {
                if (Settings.saveKey)
                {
                    Settings.logOutHotKey = Marshal.ReadInt32(lParam);
                }
                if (Marshal.ReadInt32(lParam) == Settings.logOutHotKey)
                {
                    KeyBoardAction?.Invoke(null, new EventArgs());
                }
            }

            return(CallNextHookEx(_hookID, nCode, wParam, lParam));
        }