Wolfgang Chien's Homepage | Delphi學習筆記 - 問答篇 |
要如何active自己的application?我試過 SendMessage(Application.handle,CM_ACTIVATE,0,0)為何沒用?
建議您可以改用 SetForegroundWindow 試試.(Delphi 2)
![]() |
1. File | New Application |
![]() |
2. 在 Form1 上放置一個 TTimer, 並將之 Interval 屬性調大, 例如: 6000 |
![]() |
3. Timer1 的 OnTimer 事件:
procedure TForm1.Timer1Timer(Sender: TObject); begin Timer1.Enabled := False; SetForegroundWindow(Form1.Handle); // SetForegroundWindow(Application.Handle); end; |
![]() |
4. 執行, 在六秒鐘內, 以滑鼠點到其他視窗, 六秒一到, 我們的視窗就會浮到最上視窗了. |
首頁 | 學習筆記 | 主題公園 | 軟體下載 | 關於本站 | 討論信群 | 相約下次 |