用API函数SetWindowPos可以将任何窗体设置成为TopMost窗体, 即AlswaysOnTop:
function SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND;
X, Y, cx, cy: Integer; uFlags: UINT): BOOL; stdcall;
其中:
hWnd: 窗体的 handle (参见已答问题如何得到窗体的handle)
hWndInsertAfter: 设置为 HWND_TOPMOST
其他信息可以用 GetWindowPlacement 函数得到
function GetWindowPlacement(hWnd: HWND; WindowPlacement: PWindowPlacement): BOOL; stdcall;
PWindowPlacement = ^TWindowPlacement;
{$EXTERNALSYM tagWINDOWPLACEMENT}
tagWINDOWPLACEMENT = packed record
length: UINT;
flags: UINT;
showCmd: UINT;
ptMinPosition: TPoint;
ptMaxPosition: TPoint;
rcNormalPosition: TRect;
end;