Article View: borland.public.cppbuilder.nativeapi
Article #8421Re: Communication between two applications
From: Remy Lebeau (TeamB)
Date: Sat, 30 Oct 2004 18:20
Date: Sat, 30 Oct 2004 18:20
30 lines
2090 bytes
2090 bytes
"Stefano Bonifazi" <stefboombastic@tele2.it> wrote in message
news:41827ab9@newsgroups.borland.com...
> char YourChar='c'; //change it with the character U need :)
If you are passing a single character, then WM_COPYDATA is way overkill.
Just pass the character inside the message directly. A single character is
just 8 bits, that can easily fit inside the 32 bits that are available for
both the wParam and lParam parameters of the message. For example:
#define MY_CUSTOM_MESSAGE (WM_APP + 100)
SendMessage(pReceiveAppHandle, MY_CUSTOM_MESSAGE, YourChar, 0);
void __fastcall TForm1::WndProc(TMessage &Message)
{
if( Message.Msg == MY_CUSTOM_MESSAGE )
ShowMessage("Character arrived: " +
AnsiString((char)Message.WParam));
else
TForm::WndProc(Message);
}
BTW, in your earlier example, your parameters for WM_COPYDATA were reversed.
You were passing the COPYDATASTRUCT in the wParam when you should have been
passing it in the lParam instead.
Gambit
Technical Details
Message-ID:
<4183db21$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41824B51.804A82A5@ulb.ac.be> <41827ab9@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e336fb05149be70e 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: <41824B51.804A82A5@ulb.ac.be> <41827ab9@newsgroups.borland.com> Subject: Re: Communication between two applications Date: Sat, 30 Oct 2004 11:20:12 -0700 Lines: 33 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: <4183db21$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1099160353 68.69.17.41 (30 Oct 2004 11:19:13 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail