Article View: borland.public.cppbuilder.nativeapi
Article #4893Windows shutdown not closing my app
From: Joseph F. Muscarella
Date: Thu, 10 Nov 2005 14:11
Date: Thu, 10 Nov 2005 14:11
24 lines
2020 bytes
2020 bytes
I have Googled this to death, and have seen quite a bit about similar problems, but not exactly like my situation. I have an application (normal app, not system tray like many I saw) that uses the OnCloseQuery handler to do some cleanup before the app terminates. Works great when the user closes the application. However, when Windows does a shutdown things are different. My OnCloseQuery handler is being executed. It is setting CanClose to true. But, Windows is not closing my app and aborts the shutdown process. This leaves my app running, but since I did my cleanup, in an unstable state. Why would Windows not shut down my app if I told it that it CanClose? I am not using AllocateHWND as was suggested in many previous posts. I do have a custom component that overrides the WndProc(), but it passes processing of all but one message (WM_GETDLGCODE) on to TWinControl's WndProc(). This is the only WndProc that I have overridden myself. I tried having this WndProc() trap the WM_QUERYENDSESSION message and set the Result to 1, but this did not help. Any help is greatly appreciated. Joe
Technical Details
Message-ID:
<437354f8@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6f884ae678fc34b6,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Joseph F. Muscarella" <joe@infosight-DISCARDMUNG-.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Windows shutdown not closing my app Date: Thu, 10 Nov 2005 09:11:34 -0500 Lines: 26 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 NNTP-Posting-Host: 216.201.4.180 Message-ID: <437354f8@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1131631864 216.201.4.180 (10 Nov 2005 06:11:04 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail