type<br> TForm1 = class(TForm)<br> ListBox1: TListBox;<br> Button1: TButton;<br> Button2: TButton;<br> procedure Button1Click(Sender: TObject);<br> procedure Button2Click(Sender: TObject);<br> private<br> { Private declarations }<br> procedure MyQuseryEnd(var msg: TMessage ); Message WM_QUERYENDSESSION;<br> public<br> { Public declarations }<br> end;<br><br>procedure TForm1.MyQuseryEnd(var msg:TMessage );<br>begin<br> //如果不提示就直接msg.Result:=0;<br> if MessageBox(Handle, '是否关机', '提示', $24)<>IDYES then msg.Result:=0;<br>end;