Article View: borland.public.cppbuilder.nativeapi
Article #15761Re: WM_ENDSESSION + Win2k/WinXP
From: Frank Gruber
Date: Wed, 18 Jun 2003 17:36
Date: Wed, 18 Jun 2003 17:36
44 lines
2683 bytes
2683 bytes
> If I remember correctly, I think 2K/XP has a timeout period for that > message. If you do not return control back to the OS in a timely fashion, > the OS moves on anyway and assumes your application stopped responding. Try > utilizing the WM_QUERYENDSESSION message as well, do some of your cleanup > work there as well, so that WM_ENDSESSION has less work to do and can return > back to the OS faster. That seems not to be entirely correct. If the timeout is reached Windows displays a messagescreen where you are informed that the app in question is not responding and you are asked to cancel it. But this message is not displayed in my app. If I put a Sleep(10000) as first statement in the WM_ENDSESSION eventhandler I get this messagescreen. If I remove this line I get nothing and the app is terminated quite fast but the last statements in the WM_ENDSESSION event handler are not reached. It also does not explain why all works correct if the app is not hidden. It seems that one of the actions I perform directly or indirectly in the event handler makes Windows immediately interrupt it. It is getting even better. As shutdown is difficult to debug I put a fopen, sprintf, fclose sequence after every action I perform in the event handler to find out where the handler is getting interrupted. With these lines inside the message handler it is no longer interrupted by Windows. If I remove these lines the problem comes back. IMHO the whole Windows shutdown process was allways full of quirks, badly designed or at least badly dokumented. Just my 2 cents. Everybody who has comments or experiences with Windows shutdown is kindly invited to this discussion. Thank's. Regards, Frank.
Technical Details
Message-ID:
<3ef0a332@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3ef08c31$1@newsgroups.borland.com> <3ef09b02$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,9e00bf1ef85252e4 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-06-18 10:41:36 PST From: "Frank Gruber" <HVFDMIPUMFPS@spammotel.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ef08c31$1@newsgroups.borland.com> <3ef09b02$1@newsgroups.borland.com> Subject: Re: WM_ENDSESSION + Win2k/WinXP Date: Wed, 18 Jun 2003 19:36:53 +0200 Lines: 46 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 217.231.164.214 Message-ID: <3ef0a332@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1055957810 217.231.164.214 (18 Jun 2003 10:36:50 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail