老问题了,看下面:<br>/////////////////////////<br>方法一:<br>先setforegroundwindow(HWND);然后再setwindowpos(form2.Handle,HWND_TOPmost,10,10,200,300,SWP_SHOWWINDOW );<br>////////////////////////<br><br>方法二:<br>关键技术是重载Form的CreateParams方法<br>{form2 code}<br>public<br> procedure CreateParams(Var Params:TCreateParams);override;<br><br>uses unit1;<br>procedure tform2.CreateParams(var Params:TCreateParams);<br>begin<br> inherited;<br> With Params do<br> begin<br> wndParent:=GetDesktopwindow;<br> ExStyle:=ExStyle or WS_EX_TOPMOST;<br> end;<br>end;<br><br>procedure TForm2.FormClose(Sender :TObject;var Action:TCloseAction);<br>begin<br> Form1.show;<br> ShowWindow(Application.handle,sw_show);<br>end;<br><br><br>{Form1}<br>uses unit2;<br>procedure TForm1.Button1Click(Sender:TObject);<br>begin<br> with tform2.create(self) do show;<br> hide; {Hide Form1}<br> ShowWindow(Application.handle,sw_hide); {Hide Application}<br>end;<br>