procedure WMQueryEndSession(var Message: TWMQueryEndSession); message WM_QUERYENDSESSION;
procedure WMPowerBroadcast(var Message: TMessage); message WM_POWERBROADCAST;
procedure TMainForm.WMQueryEndSession(var Message: TWMQueryEndSession);
begin
Message.Result := 0;
SetForegroundWindow(Handle);
//if SysIni.ReadBool(seOffDutyRemind, idRemindOnShutdown, True) then
// OffDutyRemind;
if Ask('关机', '现在关机吗') then Shutdown;
end;
procedure TMainForm.WMPowerBroadcast(var Message: TMessage);
begin
Message.Result := BROADCAST_QUERY_DENY;
SetForegroundWindow(Handle);
//if SysIni.ReadBool(seOffDutyRemind, idRemindOnShutdown, True) then
// OffDutyRemind;
if Ask('休眠', '现在休眠吗') then Hibernate;
end;
----
http://www.8421.org