Article View: borland.public.cppbuilder.nativeapi
Article #2299Re: My app closes, but cancels Windows shutdown?
From: A Nonymous
Date: Fri, 09 Mar 2007 22:50
Date: Fri, 09 Mar 2007 22:50
60 lines
3485 bytes
3485 bytes
"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote in news:45f1d8a5$1 @newsgroups.borland.com: > > "A Nonymous" <anonymous@hotmail.com> wrote in message > news:Xns98EE9F12960D1anonymoushotmailcom@207.105.83.66... > >> I modified my fake shutdown utility to list all window handles > before >> sending the terminate to the main form. Wow! I had 635 handles >> before the shutdown, and after the shutdown there were 439. I >> was amazed to see that my app had 200 window handles. > > It is very unlikely that it has 200 top-level windows, unless you have > a lot of components creating hidden windows. I would expect the > program to have 200 windows if you are taking all of the child windows > into account, though. > This surprised mee too. It may be due to some of theois 3rd party components. I only have about 40 total forms, and most of those are dynamically created as needed. (pop up edit dialogs,and such) >> Now I just have to figure out this example code for tracing the >> messages. In concept I understand it, but I need to figure out how >> to implement it in my app. > > Just copy/paste it as-is into the main source file of the project, > where WinMain() is implemented. > > > Gambit > > > Well you are right it was easy. I was concerned that I might have trouble writing to a log file from there or something, but it went in without a hitch. Now the bad news... It doesn't seem to work. I get nothing. In fact I tried setting a breakpoint on the if( nCode == HC_ACTION ) line and then using my fake shutdown utility to send a WM_QUERYENDSESSION. The app closed, but the break point was never reached. A dumb question that just occurred to me. Should the hHook = SetWindowsHookEx line be the first line in the WINAPI WinMani function or shold it come after the Application->Initialize()? Right now it is the first line, and the UnhookWindowsHookEx is on the second to last line just above the return 0; Is there something else I need to to to make this work? OK, I just checked one other thing. I put a break point on the SetWindowsHookEx and after I stepped over it hHook was still NULL. Is this normal? Anyhow I really appreciate the help.
Technical Details
Message-ID:
<Xns98EEAB7C7DA52anonymoushotmailcom@207.105.83.66>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.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>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,346f60f70c29a156 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: My app closes, but cancels Windows shutdown? From: A Nonymous <anonymous@hotmail.com> 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> Message-ID: <Xns98EEAB7C7DA52anonymoushotmailcom@207.105.83.66> User-Agent: Xnews/5.04.25 NNTP-Posting-Host: 74.254.162.162 Date: 9 Mar 2007 14:50:52 -0800 X-Trace: newsgroups.borland.com 1173480652 74.254.162.162 (9 Mar 2007 14:50:52 -0800) Lines: 60 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail