<br>//用以下程序试试看<br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> Timer1.Interval := 3000;//三秒后关闭<br> Timer1.Enabled := true;<br> MessageBox(handle,'测试','错误',MB_ICONERROR+MB_OK);<br>end;<br><br>procedure TForm1.Timer1Timer(Sender: TObject);<br>begin<br> PostMessage(FindWindow('#32770',nil),WM_CLOSE,0,0);<br> Timer1.Enabled := false;<br>end;<br>