🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: SendMessage() repetition error

#5787
From: Remy Lebeau (TeamB)
Date: Fri, 01 Jul 2005 01:30
30 lines
2083 bytes
"Daniel Stevenson" <daniel@ocreage.com.au> wrote in message
news:42c49259@newsgroups.borland.com...

> Pappa has to wait until Bubba.exe has finished executing before
> continuing so I have used SendMessage() to tell Papa.exe when
> it is finished.

An easier, and more reliable, way is to use WaitForSingleObject() instead.
CreateProcess() returns the HANDLE for the newly spawned process.  You can
pass that HANDLE to WaitForSingleObject(), which will not return until the
process has terminated.

> This all works fine, my problem is that Papa.exe has to execute Bubba.exe
> two times.  After the first exeution Papa.exe receives the message from
> Bubba.exe to say it has finished, so Papa.exe then executes bubba.exe a
> second time with it's new parameters.

Using WaitForSingleObject() will simplify that by not using any messages at
all, as well as streamlining your code.

> Bubba then performs its duties again but when it sends it's finish message
> using SendMessage(), Papa.exe doesn't see the message.
<snip>
>Can anyone see why I wouldn't be seeing the second SendMessage()?

No, because you did not show any of Papa's code that is executing Bubba.


Gambit
Technical Details
Message-ID: <42c49e3e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <42c49259@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,696995b85f90e7d7
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: <42c49259@newsgroups.borland.com>
Subject: Re: SendMessage() repetition error
Date: Thu, 30 Jun 2005 18:30:10 -0700
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: 68.69.17.41
Message-ID: <42c49e3e$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1120181822 68.69.17.41 (30 Jun 2005 18:37:02 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail