delphi中,窗体怎么才能在最前方

来源:百度知道 编辑:UC知道 时间:2024/06/05 02:41:04
delphi中,窗体怎么才能在最前方

Form1.FormStyle:=fsStayOnTop;

procedure setWindowTopMost;
var p:TPoint;
childWnd,parentWnd:HWND;
begin
GetCursorPos(p);
childWnd:=WindowFromPoint(p);
parentWnd:=GetParent(childWnd);
if parentWnd<>GetDesktopWindow then
begin
SetWindowPos(childWnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE);
end;
end;