public static void SetTop(IntPtr?handle = null) { if (handle == null) { handle = MainWindowHandle; } ChoUser32.SetWindowPos(handle.Value, (IntPtr)SpecialWindowHandles.HWND_TOP, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_SHOWWINDOW); }
public static void AlwaysOnTop(bool set) { if (HasWindow) { if (set) { ChoUser32.SetWindowPos(MainWindowHandle, (IntPtr)SpecialWindowHandles.HWND_TOPMOST, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_SHOWWINDOW); } else { ChoUser32.SetWindowPos(MainWindowHandle, (IntPtr)SpecialWindowHandles.HWND_NOTOPMOST, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_SHOWWINDOW); } } }