SetWindowTopMost
From SCAR Divi Manual
Contents
Definition
procedure SetWindowTopMost(const Wnd: Hwnd; const TopMost: Boolean);
Source Code
procedure SetWindowTopMost(const Wnd: Hwnd; const TopMost: Boolean); begin if IsWinfow(Window) then if Top then SetWindowPos(Window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE) else SetWindowPos(Window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE); end;
Availability
SCAR Divi 3.35 > Current
Aliases
- SetOnTop (SCAR Divi 3.12 > 3.34)
Description
Adds the HWND_TOPMOST flag to a window specified by it's handle Wnd if TopMost is true, this will move the window in the topmost position on your desktop. If TopMost is false, it will add the flag HWND_NOTOPMOST, which will remove the window from it's topmost position. The function will only work on windows outside of the SCAR process which is running the script.
Internal Flags[1]
- HWND_TOPMOST: Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.
- HWND_NOTOPMOST: Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
Example
var Wnds: THwndArray; begin Wnds := FindWindowsEx(GetDesktopWindow, 'notepad', '', False, False, True); if Length(Wnds) > 0 then SetWindowTopMost(Wnds[0], True); end.