Article View: borland.public.cppbuilder.nativeapi
Article #2250Re: My app closes, but cancels Windows shutdown?
From: Remy Lebeau (TeamB)
Date: Fri, 16 Mar 2007 00:36
Date: Fri, 16 Mar 2007 00:36
45 lines
3341 bytes
3341 bytes
"Mike K" <nospam@nospam.net> wrote in message news:45f9bb86$1@newsgroups.borland.com... > what if my app needs a few seconds to clean up, and the OnCloseQuery() > method has come and gone? Then you will need to set CanClose to false in the OnCloseQuery event, hide the form so the user thinks it is closed, and then close it again when you are actually ready for it. Alternatively, you could have the OnCloseQuery handler show the shutdown form non-modally, then disable the closing form so the user can't interact with it, and run a temporary message loop until all actions have been finished before then finally exiting from the handler. That way, the closing is blocked, but the shutdown continues. > I have a large app that opens a shutdown form and iterates through > several timer loops waiting for databases to close, queues to flush, > files to close, etc. Sounds like things that should probably be threaded instead. Then you simply wait for the threads to terminate. > As soon as I leave the form's OnShow method (relying on the > timers to come back) I return to the OnCLoseQuery() which > exits (with CanClose set FALSE), and my control is lost. > > The shutdown timers, once they're happy, eventually call > Application->Terminate(). That is fine. OnCloseQuery is not triggered once Terminate() is called. The form is simply destroyed. So you could keep setting CanClose to false anytime the form wants to be closed, and then the app will force it closed when it is ready. > Can I use SendMessage() to send a belated message to windows > that Yes, NOW I'm ready, or is it too late by then? No. It is too late. Gambit
Technical Details
Message-ID:
<45f9daab$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<Xns98ED90968E734anonymoushotmailcom@207.105.83.66> <45f07307@newsgroups.borland.com> <Xns98ED988E421A8anonymoushotmailcom@207.105.83.66> <45f08f8f$1@newsgroups.borland.com> <Xns98EDAC20DAA4Eanonymoushotmailcom@207.105.83.66> <45f095bf$1@newsgroups.borland.com> <45f0a594@newsgroups.borland.com> <45f0a77f$1@newsgroups.borland.com> <45f0d6c1@newsgroups.borland.com> <Xns98EE722D896C6anonymoushotmailcom@207.105.83.66> <45f1a96b$1@newsgroups.borland.com> <Xns98EE9F12960D1anonymoushotmailcom@207.105.83.66> <45f1d8a5$1@newsgroups.borland.com> <Xns98EEAB7C7DA52anonymoushotmailcom@207.105.83.66> <45f1ffc0$1@newsgroups.borland.com> <Xns98EF8B2886544anonymoushotmailcom@207.105.83.66> <45f3285b$1@newsgroups.borland.com> <Xns98F270DA48944anonymoushotmailcom@207.105.83.66> <45f6e2fe$1@newsgroups.borland.com> <45f9bb86$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,346f60f70c29a156 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <Xns98ED90968E734anonymoushotmailcom@207.105.83.66> <45f07307@newsgroups.borland.com> <Xns98ED988E421A8anonymoushotmailcom@207.105.83.66> <45f08f8f$1@newsgroups.borland.com> <Xns98EDAC20DAA4Eanonymoushotmailcom@207.105.83.66> <45f095bf$1@newsgroups.borland.com> <45f0a594@newsgroups.borland.com> <45f0a77f$1@newsgroups.borland.com> <45f0d6c1@newsgroups.borland.com> <Xns98EE722D896C6anonymoushotmailcom@207.105.83.66> <45f1a96b$1@newsgroups.borland.com> <Xns98EE9F12960D1anonymoushotmailcom@207.105.83.66> <45f1d8a5$1@newsgroups.borland.com> <Xns98EEAB7C7DA52anonymoushotmailcom@207.105.83.66> <45f1ffc0$1@newsgroups.borland.com> <Xns98EF8B2886544anonymoushotmailcom@207.105.83.66> <45f3285b$1@newsgroups.borland.com> <Xns98F270DA48944anonymoushotmailcom@207.105.83.66> <45f6e2fe$1@newsgroups.borland.com> <45f9bb86$1@newsgroups.borland.com> Subject: Re: My app closes, but cancels Windows shutdown? Date: Thu, 15 Mar 2007 16:36:19 -0800 Lines: 47 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 75.83.34.171 Message-ID: <45f9daab$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1174002347 75.83.34.171 (15 Mar 2007 16:45:47 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail