Article View: borland.public.cppbuilder.nativeapi
Article #8784WM_COPYDATA problem
From: Boba
Date: Tue, 14 Sep 2004 19:15
Date: Tue, 14 Sep 2004 19:15
23 lines
1636 bytes
1636 bytes
Hallo, I use the WM_COPYDATA message to send the AnsiString content between TApplications. Once in a while (I'd say <10% cases) the string will arrive corrupt at the end. Are there any special considerations regarding usage of this message for data exchange? or should I ask in .components.using NG ? Here's what I do: //sending: COPYDATASTRUCT cds; cds.dwData=1;//number of strings to be sent cds.cbData=AnsiStringToSend.Length();//<1024 cds.lpData=AnsiStringToSend.c_str(); ::SendMessage(hWndOfReceiver,WM_COPYDATA, 0,(LPARAM)&cds); //reciving: char buff[1024]; ::ZeroMemory(buff,sizeof(buff)); ::CopyMemory(buff,Msg.CopyDataStruct->lpData,Msg.CopyDataStruct->cbData); //where Msg is of ref. to TWMCopyData type AnsiString s=AnsiString(buff); ShowMessage(s);//some strings get corrupt. Why? Please help. Boba.
Technical Details
Message-ID:
<4147428c@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.zanker.org!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2368611c57840a13,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Boba" <Boba@somewhere.world> Newsgroups: borland.public.cppbuilder.nativeapi Subject: WM_COPYDATA problem Date: Tue, 14 Sep 2004 14:15:36 -0500 Lines: 26 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.128 Message-ID: <4147428c@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1095189132 208.210.156.128 (14 Sep 2004 12:12:12 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.zanker.org!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail