🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2301

Re: My app closes, but cancels Windows shutdown?

#2301
From: Remy Lebeau (TeamB)
Date: Sat, 10 Mar 2007 00:45
30 lines
2597 bytes
"A Nonymous" <anonymous@hotmail.com> wrote in message
news:Xns98EEAB7C7DA52anonymoushotmailcom@207.105.83.66...

> 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.

Then SetWindowsHookEx() is failing to install the hook.  Try passing
the value of WinMain's hInstance parameter to SetWindowsHookEx's hMod
parameter.

> Should the hHook = SetWindowsHookEx line be the first line
> in the WINAPI WinMani function or shold it come after the
> Application->Initialize()?

In this situation, it doesn't really matter mcuh, since the forms have
not been created yet.  I would suggest calling it before, though, so
it is in place before any VCL initializations occur.

> 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?

No.  That is a failure.


Gambit
Technical Details
Message-ID: <45f1ffc0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.de!news.albasani.net!feeder06.uucp-net.de!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail
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> <Xns98EEAB7C7DA52anonymoushotmailcom@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> <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> <Xns98EEAB7C7DA52anonymoushotmailcom@207.105.83.66>
Subject: Re: My app closes, but cancels Windows shutdown?
Date: Fri, 9 Mar 2007 16:45:52 -0800
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: 75.83.34.171
Message-ID: <45f1ffc0$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1173487552 75.83.34.171 (9 Mar 2007 16:45:52 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.de!news.albasani.net!feeder06.uucp-net.de!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail