如何在有很多应用程序运行的情况下,使一个应用程序跳到前台来(100分)

  • 主题发起人 主题发起人 dhch
  • 开始时间 开始时间
D

dhch

Unregistered / Unconfirmed
GUEST, unregistred user!
      当某个条件符合时,该窗口置前
 
SetForegroundWindow(<br>&nbsp; &nbsp; HWND hWnd // handle of window to bring to foreground<br>&nbsp; &nbsp;);
 
嗬嗬,看看我的这个贴子:<br>http://www.delphibbs.com/delphibbs/dispq.asp?lid=676583<br>“把窗口显示出来(包括最小化的窗口也能恢复最小化前大小) ”
 
我试了,好像不行的<br>&nbsp; &nbsp;好像只能在同一个应用程序中,这个函数才可以用啊
 
&nbsp;SetForegroundWindow(application.handle);<br>&nbsp; ShowWindow(application.handle, SW_RESTORE);<br>
 
试了,上面的不行。
 
&nbsp;ShowWindow(application.handle, SW_RESTORE);<br>&nbsp; SetForegroundWindow(application.handle);<br>肯定行的。<br>&nbsp; <br><br>&nbsp;<br>
 
procedure TForm1.Timer1Timer(Sender: TObject);<br>begin<br>&nbsp; ShowWindow(application.handle, SW_RESTORE);<br>&nbsp; SetForegroundWindow (application.handle);<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>&nbsp; SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, 0, SPIF_SENDWININICHANGE or SPIF_UPDATEINIFILE);<br>end;<br>这样可以。<br>
 
这样就行:<br>[red]procedure TForm1.Button2Click(Sender: TObject);<br>var<br>&nbsp; hwnd1: HWND;<br>begin<br>&nbsp; hwnd1:= FindWindow(PChar('IEFrame'),PChar('大富翁论坛 delphibbs.com - Microsoft Internet Explorer'));<br>&nbsp; if hwnd1 &lt;&gt; 0 then<br>&nbsp; begin<br>&nbsp; &nbsp; ShowWindow(hwnd1,SW_RESTORE);<br>&nbsp; &nbsp; SetForegroundWindow(hwnd1);<br>&nbsp; end;<br>end;[/red]
 
肯定行的:<br>&nbsp; &nbsp; &nbsp; Hwnd := FindWindow(nil,'应用程序的Title');<br>&nbsp; &nbsp; &nbsp; PostMessage(Hwnd, WM_USER, 0, 0);<br>&nbsp; &nbsp; &nbsp; ShowWindow(Hwnd, SW_RESTORE);<br>&nbsp; &nbsp; &nbsp; SetForegroundWindow(Hwnd);
 
用这个:<br><br>BOOL BringWindowToTop(<br><br>&nbsp; &nbsp; HWND hWnd // handle to window<br>&nbsp; &nbsp;);
 
多人接受答案了。
 
后退
顶部