๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #12878

Re: Application notification on Machine restart or shutdown

#12878
From: Remy Lebeau (TeamB)
Date: Wed, 12 Nov 2003 00:46
35 lines
2348 bytes
"Conny H๏ฟฝkansson" <conny@allimac.se> wrote in message
news:3fb17fcd@newsgroups.borland.com...

> it claims that each application is responsible to reply true
> or false on this message.

Correct.

> If i want to intercept this message with the HookMainWindow()
> how do i return a response to the OS?

Use the TMessage::Result member.  Also have your hook function itself return
either 'true' or 'false' depending on whether you want the message to
continue being processed or not by the rest of the application.

> What will be the OS action to a NO response? Will it try again
> with yet another WM_QUERYENDSESSION until it finaly
> recevies a YES?

No, if an application returns "no" to WM_QUERYENDSESSION, the
shutdown/logout is aborted altogether.

> Im trying to but some time here, cuase I noticed when acting on
> the WM_ENDSESSION message, the system goes down before
> my application has finished its cleaning up operations.

You need to finish your cleanup *before* returning from WM_ENDSESSION.
WM_QUERYENDSESSION notifies you that a shutdown/logout is about to occur but
has not happened yet.  WM_ENDSESSION, on the other hand, indicates that the
shutdown/logout *will* occur, and can happen at any time after you finish
processing the message.


Gambit
Technical Details
Message-ID: <3fb1820b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.he.net!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3fb15541@newsgroups.borland.com> <3fb15956$1@newsgroups.borland.com> <3fb17fcd@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10cc67,c54773486c2a14af
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-11-11 17:07:24 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3fb15541@newsgroups.borland.com> <3fb15956$1@newsgroups.borland.com> <3fb17fcd@newsgroups.borland.com>
Subject: Re: Application notification on Machine restart or shutdown
Date: Tue, 11 Nov 2003 16:46:16 -0800
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.22.137.149
Message-ID: <3fb1820b$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1068597771 67.22.137.149 (11 Nov 2003 16:42:51 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.he.net!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail