Article View: borland.public.cppbuilder.nativeapi
Article #8793Re: WM_COPYDATA problem
From: Remy Lebeau
Date: Wed, 15 Sep 2004 19:56
Date: Wed, 15 Sep 2004 19:56
32 lines
1899 bytes
1899 bytes
"Boba" <Boba@somewhere.world> wrote in message news:<4147428c@newsgroups.borland.com>...
> cds.dwData=1;//number of strings to be sent
That is not a very good value to use in thisa case. You should be
sending a unique ID number instead of the number of strings included
in the data. The VCL itself uses M_COPYDATA for its own uses as well.
dwData is meant to be used as a means of differentiating between
messages targetted at different windows, etc. If you need to send the
number of strings, then you should allocate a little extra memory and
put the string count inside the acutal data itself.
> char buff[1024];
> ::ZeroMemory(buff,sizeof(buff));
> ::CopyMemory(buff,Msg.CopyDataStruct->lpData,Msg.CopyDataStruct->cbData);
You can convert the data directly to AnsiString instead of using a
separate buffer:
AnsiString s;
s.SetLength(Msg.CopyDataStruct->cbData);
::CopyMemory(s.c_str(), Msg.CopyDataStruct->lpData,
Msg.CopyDataStruct->cbData);
Or simply:
AnsiString s((char*)Msg.CopyDataStruct->lpData,
Msg.CopyDataStruct->cbData);
Gambit
Technical Details
Message-ID:
<20e33bb0.0409151156.523ba05b@posting.google.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews2.google.com!not-for-mailReferences:
<4147428c@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 Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews2.google.com!not-for-mail From: gambit47@yahoo.com (Remy Lebeau) Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: WM_COPYDATA problem Date: 15 Sep 2004 12:56:13 -0700 Organization: http://groups.google.com Lines: 32 Message-ID: <20e33bb0.0409151156.523ba05b@posting.google.com> References: <4147428c@newsgroups.borland.com> NNTP-Posting-Host: 216.2.30.125 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1095278174 1391 127.0.0.1 (15 Sep 2004 19:56:14 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 15 Sep 2004 19:56:14 +0000 (UTC)