如何截获关机消息???(50分)

  • 主题发起人 主题发起人 zfp
  • 开始时间 开始时间
Z

zfp

Unregistered / Unconfirmed
GUEST, unregistred user!
&nbsp; &nbsp; 不经过确认不想让别人关机,如何在别人关机时出现一个提示窗口,这有几个情况,如<br>点程序-&gt;关机;或按Ctrl_Del+Alt等。<br>&nbsp; &nbsp; &nbsp;请问如何实现?
 
jingtao (2000-5-29 23:35:36) &nbsp;<br>------------------------------------<br>unit Unit1; <br>interfaceuses <br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, &nbsp;<br>Dialogs; <br>type <br>&nbsp; TForm1 = class(TForm) &nbsp; <br>&nbsp; procedure FormCreate(Sender: TObject); &nbsp;private <br>&nbsp; &nbsp; { Private declarations } <br>&nbsp; &nbsp; procedure winexit(var msg:Tmessage);message WM_QUERYENDSESSION; &nbsp;<br>&nbsp;public <br>&nbsp; &nbsp; { Public declarations } &nbsp;<br>&nbsp;end; <br>var &nbsp;Form1: TForm1; <br>implementation <br>{$R *.DFM} <br>procedure TForm1.FormCreate(Sender: TObject);beginend; <br><br>procedure TForm1.winexit(var msg: Tmessage); <br>begin <br>showmessage('关机了!'); <br>end; <br>&nbsp;<br>
 
响应 WM_QUERYENDSESSION 消息<br>&nbsp;procedure WMQueryEndSession (var Message: TMessage); message WM_QUERYENDSESSION ; <br>如果返回0,表明不能关闭
 
<br>你可以看看 ExitWindowsEx 的帮助<br>
 
接受答案了.
 
后退
顶部