防止Windows关闭 [英] Preventing Windows shut down
本文介绍了防止Windows关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
要检测并防止计算机关机,我使用了非常简单的程序.它只有一种形式和一种私有过程,如下所示:
To detect and prevent shutdown the computer I use very simple program. It has only one form and one private procedure like below:
TForm3 = class(TForm)
private
procedure WMQueryEndSession(var Msg : TWMQueryEndSession) ;
message WM_QueryEndSession;
end;
和实施
procedure TForm3.WMQueryEndSession(var Msg: TWMQueryEndSession);
begin
Msg.Result := 0; //so I don't want to shutdown while my program is running
end;
我将其编译为Delphi 5和Delphi2010.它们都检测到关闭.但是当我在Delphi 2010中进行编译时;防止关机后,我的程序关闭. (电脑无法关闭)
I compiled it Delphi 5 and Delphi 2010. Both of them detect shutdown. But when I compiled in Delphi 2010; after preventing shutdown my program closes. (PC doesn't shutdown)
我如何从两个人那里得到相同的结果?
How do I get the same result from both of them?
推荐答案
这看起来像是Delphi中的错误.建议您将其发布在Quality Central上.
This looks like a bug in Delphi. I suggest you to post this on Quality Central.
这篇关于防止Windows关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文