application.messagebox弹出的对话框和ShowModal,是处在屏幕最上面,可以取巧一下直接用GetActiveWindow来找窗口的句柄。下面是写在timer控件里的代码,测试通过!(注意timer1.enabled:=false 只有点击按键弹出messagebox后才true)<br>var<br> ActiveWindow: THandle;<br>begin<br> ActiveWindow := GetActiveWindow;<br> PostMessage(ActiveWindow,WM_CLOSE,0,0);