Board index » delphi » WM_QUERYENDSESSION

WM_QUERYENDSESSION

Hi

I've read in the Win32 help that WinNT on Shutdown, Restart or Logon as a
different user, sends a WM_QUERYENDSESSION message and is waiting for
running apps to respond True to this message. If it doesn't the shutdown is
aborted. Obviousely my app doesn't respond to the message as it doesn't
terminate and therefor prevents the system to Shutdown. How come?
I've managed to trap the message in my program so it really arrives, but...

Carsten

 

Re:WM_QUERYENDSESSION


"Carsten Ingemansson" <bigri...@swipnet.se> skrev i en meddelelse
news:bIat6.2521$341.8692@nntpserver.swip.net...

Quote
> I've read in the Win32 help that WinNT on Shutdown, Restart or Logon as a
> different user, sends a WM_QUERYENDSESSION message and is waiting for
> running apps to respond True to this message. If it doesn't the shutdown
is
> aborted. Obviousely my app doesn't respond to the message as it doesn't
> terminate and therefor prevents the system to Shutdown. How come?
> I've managed to trap the message in my program so it really arrives,

but...

Try this:

  private
    { Private declarations }
    procedure WMQUERYENDSESSION(var Msg: TMessage); message
WM_QUERYENDSESSION;

procedure TForm_Scheduler.WMQUERYENDSESSION(var Msg: TMessage);
begin
// Does this program want to allow Windows to shut down?
  Msg.Result := 1;  // Always allow Windows to shut down
end;

Finn Tolderlund

Re:WM_QUERYENDSESSION


Thanks

Carsten

"Finn Tolderlund" <XnospamYfinn.tolderlu...@Ymobilixnet.dkXnospamY> skrev i
meddelandet news:U3it6.30$dq7.13108313@news.mobilixnet.dk...

Quote

> "Carsten Ingemansson" <bigri...@swipnet.se> skrev i en meddelelse
> news:bIat6.2521$341.8692@nntpserver.swip.net...
> > I've read in the Win32 help that WinNT on Shutdown, Restart or Logon as
a
> > different user, sends a WM_QUERYENDSESSION message and is waiting for
> > running apps to respond True to this message. If it doesn't the shutdown
> is
> > aborted. Obviousely my app doesn't respond to the message as it doesn't
> > terminate and therefor prevents the system to Shutdown. How come?
> > I've managed to trap the message in my program so it really arrives,
> but...

> Try this:

>   private
>     { Private declarations }
>     procedure WMQUERYENDSESSION(var Msg: TMessage); message
> WM_QUERYENDSESSION;

> procedure TForm_Scheduler.WMQUERYENDSESSION(var Msg: TMessage);
> begin
> // Does this program want to allow Windows to shut down?
>   Msg.Result := 1;  // Always allow Windows to shut down
> end;

> Finn Tolderlund

Other Threads