private void WindowKeyboardEvent(object sender, BasicHookEventArgs e) { var wParam = e.WParam.ToInt64(); if (wParam == VK_DOWN) { var controlState = GetAsyncKeyState(VK_CONTROL) & 0x8000; var shiftState = GetAsyncKeyState(VK_SHIFT) & 0x8000; var controlKey = Convert.ToBoolean(controlState); var shiftKey = Convert.ToBoolean(shiftState); if (controlKey && shiftKey) { IntPtr handle = GetForegroundWindow(); Window window = _windows.FirstOrDefault(w => w.Handle == handle); window?.MinimizeToSystemTray(); } } }
private void WindowKeyboardEvent(object sender, BasicHookEventArgs e) { long wParam = e.WParam.ToInt64(); if (wParam == NativeConstants.VK_DOWN) { int controlState = NativeMethods.GetAsyncKeyState(NativeConstants.VK_CONTROL) & 0x8000; int shiftState = NativeMethods.GetAsyncKeyState(NativeConstants.VK_SHIFT) & 0x8000; bool controlKey = Convert.ToBoolean(controlState); bool shiftKey = Convert.ToBoolean(shiftState); if (controlKey && shiftKey) { IntPtr handle = NativeMethods.GetForegroundWindow(); Window window = _windows.FirstOrDefault(w => w.Handle == handle); if (window != null) { window.MinimizeToSystemTray(); } } } }