🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: WM_COPYDATA problem

#8810
From: Remy Lebeau [TeamB]
Date: Sat, 18 Sep 2004 04:44
50 lines
2969 bytes
"Boba" <Boba@somewhere.world> wrote:

> disagree.

Then you have not been using WM_COPYDATA very long and don't
know the best way to use it, or else you have been misusing it
all along.  What I describe is common practice amongst all
implementations of WM_COPYDATA That I have ever seen in any
program code I have ever seen, Borland-oriented, Microsoft-
oriented, or otherwise.

> I have not seen the VCL using WM_COPYDATA for
> intreproc.communications; I don't mean it does not.

I can assure you that the VCL does use WM_COPYDATA internally.
That is alos not to say that any other libraries you use in
the app may not be using WM_COPYDATA for their own purposes as
well.

> that's what WPARAM of WM_COPYDATA is for.

Wrong.  That parameter is for identifying the window who is
sending the data.  That is usually not enough to help the
receiver of the data to decide whether it should handle the
message or pass it on for other windows to handle.  Also, in
many cases, wParam is not actually used anyway and is set to 0, which doesn't help at all.  Hense the need to use the
message data's dwData value to pass your unique ID with.

> You can not do this with BCB3: the SetLength method can
> only thruncate a string.

Not true.  That is what the documentation says, but the actual
source code of AnsiString implements expansion as well.  I
have seen the source code for AnsiString in BCB3, and I have
written code under BCB3 that does expand the string memory as
expected, so I know it works fine.

> The WM_COPYDATA message description insists I make a
> copy of the buffer first.

Which is exactly what the code I showed you earlier is doing.
It allocates an AnsiString buffer to the length of the data
and then makes a copy of the data into the allocated memory.
Your code was doing the same thing, but it used a secondary
buffer to do so.  I just took out the extra step, it was not
needed.  The end effect is the same.


Gambit
Technical Details
Message-ID: <414bbd29$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4147428c@newsgroups.borland.com> <414916f7$1@newsgroups.borland.com> <41499e2b@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2368611c57840a13
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau [TeamB]" <gambit47_no_spam@yahoo_no_spam.com>
Sender: "Remy Lebeau [TeamB]" <gambit47_no_spam@yahoo_no_spam.com>
Reply-To: "Remy Lebeau [TeamB]" <gambit47_no_spam@yahoo_no_spam.com>
Subject: Re: WM_COPYDATA problem
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 206.107.212.103     
References:  <4147428c@newsgroups.borland.com> <414916f7$1@newsgroups.borland.com> <41499e2b@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <414bbd29$1@newsgroups.borland.com>
Date: 17 Sep 2004 21:44:25 -0700
X-Trace: newsgroups.borland.com 1095482665 207.105.83.66 (17 Sep 2004 21:44:25 -0700)
Lines: 51
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail