Article View: borland.public.cppbuilder.nativeapi
Article #8347Re: Allowing app to close when system asks, but prompt for user
From: Alan Bellingham
Date: Mon, 01 Nov 2004 22:19
Date: Mon, 01 Nov 2004 22:19
29 lines
2189 bytes
2189 bytes
"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?Borland%20Newsgroup> wrote: >I have an application that sits in the system tray and monitors the registry. I >use the OnCloseQuery event for the form to trap closure and prompt for a Yes or >No response. However, when the PC system is shut down or rebooted, the prompt is >interfering with proper shutdown. How can I get the app to recognise the source >of the closure request and bypass the prompt if it is system-originated? LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window WM_QUERYENDSESSION, // the message to send WPARAM wParam, // not used LPARAM lParam // logoff option ); lParam If this parameter includes ENDSESSION_LOGOFF, the user is logging off. (Note that this parameter is a bit mask. To test for this value, use a bit-wise operation; do not test for equality.) If this parameter is zero, the system is shutting down or restarting (it is not possible to determine which event is occurring). Alan Bellingham -- Me <url:mailto:alanb@episys.com> <url:http://www.doughnut.demon.co.uk/> ACCU - C, C++ and Java programming <url:http://accu.org/> The 2004 Discworld Convention <url:http://dwcon.org/>
Technical Details
Message-ID:
<2jddo0tsc6jk3a4l5rme478gvpdfv6vdmc@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4186b4ba$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ed85e305ef3f7bba X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Alan Bellingham <alanb@episys.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Allowing app to close when system asks, but prompt for user Date: Mon, 01 Nov 2004 22:19:51 +0000 Reply-To: alanb@episys.com Message-ID: <2jddo0tsc6jk3a4l5rme478gvpdfv6vdmc@4ax.com> References: <4186b4ba$1@newsgroups.borland.com> X-Newsreader: Forte Agent 2.0/32.652 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 62.49.31.105 X-Trace: newsgroups.borland.com 1099347591 62.49.31.105 (1 Nov 2004 14:19:51 -0700) Lines: 29 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail