Article View: borland.public.cppbuilder.nativeapi
Article #8802Re: WM_COPYDATA problem
From: Boba
Date: Thu, 16 Sep 2004 14:11
Date: Thu, 16 Sep 2004 14:11
48 lines
2309 bytes
2309 bytes
Sorry to continue this thread. "Remy Lebeau [TeamB]" <gambit47_no_spam@yahoo_no_spam.com> wrote in message news:414916f7$1@newsgroups.borland.com... > > You are misusing the COPYDATASTRUCT structure. disagree. > You should not be using the dwData value that way. Yes, it is an arbitrary 32-bit > application-defined value - however - it is commonly used as a unique identifer instead. > WM_COPYDATA is so commonly used, even by the VCL itself, I have not seen the VCL using WM_COPYDATA for intreproc.communications; I don't mean it does not. > that you should assign your own unique value to dwData to help differentiate between your > own WM_COPYDATA messages and those that are actually meant for other windows, that's what WPARAM of WM_COPYDATA is for. > which you should ignore. If you need to specify how many strings are in the data, then you should allocate some extra memory and put the count inside the data itself instead of in the dwData value. > ... > AnsiString s; > s.SetLength(Msg.CopyDataStruct->cbData); You can not do this with BCB3: the SetLength method can only thruncate a string. > ::CopyMemory(s.c_str(), Msg.CopyDataStruct->lpData, Msg.CopyDataStruct->cbData); > > Alternatively: > > AnsiString s((char*)Msg.CopyDataStruct->lpData, Msg.CopyDataStruct->cbData); The WM_COPYDATA message description insists I make a copy of the buffer first. Boba
Technical Details
Message-ID:
<41499e2b@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4147428c@newsgroups.borland.com> <414916f7$1@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: "Boba" <Boba@somewhere.world> Newsgroups: borland.public.cppbuilder.nativeapi References: <4147428c@newsgroups.borland.com> <414916f7$1@newsgroups.borland.com> Subject: Re: WM_COPYDATA problem Date: Thu, 16 Sep 2004 09:11:11 -0500 Lines: 51 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 NNTP-Posting-Host: 208.210.156.69 Message-ID: <41499e2b@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1095343659 208.210.156.69 (16 Sep 2004 07:07:39 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail