http://www.delphibbs.com/delphibbs/dispq.asp?lid=415809
倒,到底怎样能让一个窗口总在最前?
FormStyle设为fsStayOnTop。
procedure TForm3.CreateParams(var Params:TCreateParams);
begin
inherited;
with Params do
begin
Style:=Params.Style xor WS_DLGFRAME;
WndParent:=0;//此行
end;
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
Width:=36;
Height:=36;
SetWindowLong(Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
h : HWND;
begin
h := FindWindow(nil, PChar('无标题 - 记事本'));
if h > 0 then begin
SetWindowLong(h,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
BringWindowToTop(h);
end;
end;