Article View: borland.public.cppbuilder.nativeapi
Article #2383Re: HELP: My app closes, but cancels Windows shutdown?
From: Remy Lebeau (TeamB)
Date: Thu, 08 Mar 2007 22:57
Date: Thu, 08 Mar 2007 22:57
59 lines
3297 bytes
3297 bytes
"A Nonymous" <anonymous@hotmail.com> wrote in message news:Xns98EDAA07AFDF0anonymoushotmailcom@207.105.83.66... > I want the shutdown on Windows shutdown to be non interactive, > just save and close. That is exactly what the OnClose and OnCloseQuery events provide for you without using message hooks. It does work. I've used it many times before. > If the user manually closes the app, then I want to ask if > they want to save modified files. That is also easy to do. You can intercept the WM_SYSCOMMAND message. That is sent when the user closes the window, but not during a shutdown. You can use it to set a flag that your OnClose/Query handlers can check. > Not sure what you are asking about here. You do know that TForm windows are not standalone windows, right? The global TApplication object has its own hidden window that silently controls the TForm windows. > Is that the window that windows is actually sending the WM_QUERYENDSESSION to? It can be. > How do I get the handle, TApplication doesn't seem to work. TApplication has a Handle property. When you do your FindWindow(), look for the 'TApplication" classname instead of "TFormMain". You will also have to look for the TApplication.Title (what is displayed on the Taskbar button) as the caption to look for as well, since every VCL application has a TApplication class, so you want to make sure you use unique captions in your projects so you are searching for the right program. > how do I isolate the source. I already explained to you earlier. As far as the VCL is concerned, there is NO difference whatsoever between a real shutdown and a fake one. If the OS is not responding correctly to the VCL reporting that the shutdown is ok, then that is a problem in the OS itself, not the VCL. > The goal is to identify what is causing the problem. If it is a > component I have the source for I will try to fix it. You won't be able to do that until you have a reliable test environment with which to send fake shutdowns with. Onc you have that working properly, then you can debug the message handling inside the offending program to see who is handling the messages and how. Gambit
Technical Details
Message-ID:
<45f094d3$3@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<Xns98ED90968E734anonymoushotmailcom@207.105.83.66> <Xns98ED941B2E2C8anonymoushotmailcom@207.105.83.66> <45f08683$1@newsgroups.borland.com> <Xns98EDAA07AFDF0anonymoushotmailcom@207.105.83.66>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> <Xns98ED941B2E2C8anonymoushotmailcom@207.105.83.66> <45f08683$1@newsgroups.borland.com> <Xns98EDAA07AFDF0anonymoushotmailcom@207.105.83.66> Subject: Re: HELP: My app closes, but cancels Windows shutdown? Date: Thu, 8 Mar 2007 14:57:10 -0800 Lines: 61 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: <45f094d3$3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1173394643 75.83.34.171 (8 Mar 2007 14:57:23 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail