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)); }
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)); }