Beispiel #1
0
        public bool SetForegroundWindowPos(InsertAfter insertAfter)
        {
            HWND hWndInsertAfter           = (nint)insertAfter;
            HWND hWnd                      = GetForegroundWindow();
            const SetWindowPosFlags uFlags = SetWindowPosFlags.SWP_NOSIZE
                                             | SetWindowPosFlags.SWP_NOMOVE
                                             | SetWindowPosFlags.SWP_SHOWWINDOW;

            return(SetWindowPos(hWnd, hWndInsertAfter, 0, 0, 0, 0, uFlags));
        }
Beispiel #2
0
        private void RaiseHotKey(int hotKeyId)
        {
            InsertAfter insertAfter = hotKeyId switch
            {
                1 => InsertAfter.TopMost,
                _ => InsertAfter.NoTopMost
            };

            _windowPosService.SetForegroundWindowPos(insertAfter);
        }
    }