别搞得那么复杂,看下面的:<br>可以如下方法解决:<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> ExtCtrls;<br>type<br> TForm1 = class(TForm)<br> Timer1: TTimer;<br> procedure Timer1Timer(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> procedure WndProc(var Msg: TMessage); override;<br> end;<br><br>var<br> Form1: TForm1;<br> TimeCount:integer;<br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.WndProc(var Msg: TMessage);<br>begin<br> inherited;<br> timeCount:=0;<br>end;<br><br>procedure TForm1.Timer1Timer(Sender: TObject);<br>begin<br> inc(timeCount);<br> if timecount=1800 then close;<br>end;<br><br>end.<br>