Article View: borland.public.cppbuilder.nativeapi
Article #7698Re: WM_CLOSE / YesNo Dialog on closing program.
From: Bob Gonder
Date: Mon, 10 Jan 2005 18:34
Date: Mon, 10 Jan 2005 18:34
20 lines
1624 bytes
1624 bytes
Sinead Bunyan wrote:
>I would like to know what is the best way of asking the user for a YES/NO
>dialog when closing a program by clicking with the mouse on the X but this
>should not be required if windows is shutting down or doing a restart.
With a global bool.
static BOOL GlobalEndSession=FALSE;
Then intercept WM_ENDSESSION
case WM_ENDSESSION:
GlobalEndSession=TRUE;
Then in your WM_CLOSE
case WM_CLOSE:
if( ! GlobalEndSession )
{ if( IDYES==MessageBox(whatever) )
DestroyWindow(
Technical Details
Message-ID:
<fci5u0l3anehrfun4u8ripcdi9u9bic3f3@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newspeer1.nwr.nac.net!newsfeed.freenet.de!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41e2a036@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,d947b84c7cfca26c X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: WM_CLOSE / YesNo Dialog on closing program. Date: Mon, 10 Jan 2005 10:34:49 -0800 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <fci5u0l3anehrfun4u8ripcdi9u9bic3f3@4ax.com> References: <41e2a036@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.77.147.99 X-Trace: newsgroups.borland.com 1105382089 67.77.147.99 (10 Jan 2005 10:34:49 -0800) Lines: 23 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newspeer1.nwr.nac.net!newsfeed.freenet.de!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail