Article View: borland.public.cppbuilder.nativeapi
Article #5802Re: Detecting windows shudtown.
From: Remy Lebeau (TeamB)
Date: Sun, 03 Jul 2005 18:08
Date: Sun, 03 Jul 2005 18:08
30 lines
2109 bytes
2109 bytes
"qyte" <gyte@vivodinet.gr> wrote in message
news:42c7c82b@newsgroups.borland.com...
> void __fastcall TForm1::AppOnMessage(TMsg &Msg, bool &Handled)
> {
> if(Msg.Message==WM_QUERYENDSESSION)
You cannot catch WM_QUERYENDSESSION with the OnMessage event. OnMessage is
triggered only by messages that are posted to the message queue. That is
not the case with WM_QUERYENDSESSION, since the OS needs to know what the
application's return value for the message is in order to decide whether to
continue with the shutdown or to abort it. Use
TApplication::HookMainWindow() instead.
> When i try to shutdown my computer it doesn't shut down
> untill after i have closed my application mannually.
Then your code is blocking the shutdown. VCL applications do normally shut
down properly, so something in your own code has to be blocking it.
> The thing is the in OnClose event of Form1 i minimize it to tray.
What does that code actually look like? Are you using the OnCloseQuery
event at all as well?
Also, you never said which version of BCB you are using.
Gambit
Technical Details
Message-ID:
<42c82b33$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<42c4f6c9$1@newsgroups.borland.com> <42c50d9b$2@newsgroups.borland.com> <42c5edce$1@newsgroups.borland.com> <42c77b3f$1@newsgroups.borland.com> <42c7c82b@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6f249ce41ad1dc44 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: <42c4f6c9$1@newsgroups.borland.com> <42c50d9b$2@newsgroups.borland.com> <42c5edce$1@newsgroups.borland.com> <42c77b3f$1@newsgroups.borland.com> <42c7c82b@newsgroups.borland.com> Subject: Re: Detecting windows shudtown. Date: Sun, 3 Jul 2005 11:08:24 -0700 Lines: 32 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: 68.69.17.41 Message-ID: <42c82b33$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1120414515 68.69.17.41 (3 Jul 2005 11:15:15 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail