🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Spying WM_QUIT Msgs

#11704
From: Remy Lebeau (TeamB)
Date: Mon, 19 Jan 2004 21:05
32 lines
2241 bytes
"Rodrigo" <rmorteo@eudoramail.com> wrote in message
news:400c14ed@newsgroups.borland.com...

> I want to use this handle to be notified when WM_QUIT
> messages are posted to the spawned apps

Normally, that would involve subclassing the window.  However, you cannot
subclass a window that belongs to another process.  You would have to use a
message hook instead via the SetWindowsHookEx() function, and implement your
hook procedure inside a separate DLL.

> because I need to know when they are closed (either by the
> system or by the user). ...

What about simply passing the spawned application's handle to
WaitForSingleObject() or GetExitCodeProcess() instead?  When you spawn a new
application instance, you could start a new thread for it, giving the thread
the application's process handle.  The thread could then use
WaitForSingleObject() or GetExitCodeProcess() in a loop to wait for the
spawned process to be terminated for any reason, not just from WM_QUIT
messages.  When the process is terminated, your thread could communicate
back to your main code so that it can update itself accordingly.

> I'm currently reading on Message Queues and found the
> PeekMessage function, however, I'm not sure that what I need
> can be done and how?

It cannot be used for what you are asking for.


Gambit
Technical Details
Message-ID: <400c4532$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <400c14ed@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,43d7763b0e019d62
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-01-19 13:11:16 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <400c14ed@newsgroups.borland.com>
Subject: Re: Spying WM_QUIT Msgs
Date: Mon, 19 Jan 2004 13:05:59 -0800
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.22.138.253
Message-ID: <400c4532$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1074545970 67.22.138.253 (19 Jan 2004 12:59:30 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail