Article View: borland.public.cppbuilder.nativeapi
Article #5786SendMessage() repetition error
From: Daniel Stevenson
Date: Fri, 01 Jul 2005 00:46
Date: Fri, 01 Jul 2005 00:46
47 lines
2413 bytes
2413 bytes
I've got an application (ie. Papa.exe) that executes a second application
(Bubba.exe).
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.
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. Bubba then performs its duties again
but when it sends it's finish message using SendMessage(), Papa.exe doesn't
see the message.
I've included the code I've used.
Papamain.h
private:
void __fastcall UMSpecialMessage(TMessage &Message);
public:
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(UM_SPECIALMESSAGE,TMessage,UMSpecialMessage);
END_MESSAGE_MAP(TForm);
Papamain.cpp
void __fastcall TMyfrm::UMSpecialMessage(TMessage &Message)
{
TaskComplete = true; //this is not being called the second time
}
Bubbamain.h
#define UM_SPECIALMESSAGE (WM_USER + 1001)
Bubbamain.cpp
void __fastcall TfrmDBUpdater::FormClose(TObject *Sender,
TCloseAction &Action)
{
//Send message to notify it of completion
HWND AppHndl = FindWindow("TMyfrm", NULL);
if (AppHndl)
{
SendMessage(AppHndl, UM_SPECIALMESSAGE, 0, 0);
}
}
Can anyone see why I wouldn't be seeing the second SendMessage()?
Technical Details
Message-ID:
<42c49259@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!newsfeed2.telusplanet.net!newsfeed.telus.net!cyclone.bc.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,696995b85f90e7d7,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Daniel Stevenson" <daniel@ocreage.com.au> Newsgroups: borland.public.cppbuilder.nativeapi Subject: SendMessage() repetition error Date: Fri, 1 Jul 2005 10:46:36 +1000 Lines: 49 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: 202.174.233.53 Message-ID: <42c49259@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1120178777 202.174.233.53 (30 Jun 2005 17:46:17 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!newsfeed2.telusplanet.net!newsfeed.telus.net!cyclone.bc.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail