Friday, 6 September 2013

SendMessage function only send first character of the message fromm VC++ app to reciever (Delphi App)?

SendMessage function only send first character of the message fromm VC++
app to reciever (Delphi App)?

SendMessage only send first charter of the message VC++, can you help?
Only first charter is recieved.
Actually here is my full sender app code (VC++)
notification->FileName is UCHAR[255]
HWND app = FindWindow(NULL,TEXT("Message Receiver"));
COPYDATASTRUCT cds;
cds.dwData = 0; // can be anything
cds.cbData = sizeof(notification->FileName) - sizeof(UCHAR);
cds.lpData = (void*)notification->FileName;
SendMessageA(app, WM_COPYDATA, (WPARAM)app, (LPARAM)&cds);
My reciever code (Delphi)
procedure TfrmReceiver.WMCopyData(var Msg: TWMCopyData); var sText:
array[0..255] of Char; s: string; ms: TMemoryStream; begin case
Msg.CopyDataStruct.dwData of 0: { Receive Text, Text empfangen} begin
StrLCopy(sText, Msg.CopyDataStruct.lpData,Min(Length(sText),
Msg.CopyDataStruct.cbData)); label1.Caption := sText; end; 1: { Receive
Image, Bild empfangen} { begin ms := TMemoryStream.Create; try with
Msg.CopyDataStruct^ do ms.Write(lpdata^, cbdata); ms.Position := 0;
image1.Picture.Bitmap.LoadFromStream(ms); finally ms.Free; end; end; }
end; end;

No comments:

Post a Comment