i am sending data to a delphi app using WM_COPYDATA from vb6 app. in my system which local is english, i receive the data correctly, but on another system with dutch local, the receive text is garbled.
the receiving app is the delphi, the code is
procedure TReceiverMainForm.WMCopyData(var Msg: TWMCopyData);
var
copyDataType: TCopyDataType;
begin
copyDataType := TCopyDataType(Msg.CopyDataStruct.dwData);
//Handle of the Sender
mmoResult.Lines.Add(Format('WM_CopyData from: %d', [msg.From]));
case copyDataType of
cdtString: HandleCopyDataString(Msg.CopyDataStruct);
end;
//Send something back
msg.Result := mmoResult.Lines.Count;
end;
procedure TReceiverMainForm.HandleCopyDataString(
copyDataStruct: PCopyDataStruct);
var
s: string;
begin
s := PChar(copyDataStruct.lpData);
mmoResult.Lines.Add(s);
end;
EDIT
here is the vb6 code that is sending the data, the data am sending is string
Dim buf() As Byte
ReDim buf(1 To LenB(Message))
Call CopyMemory(buf(1), ByVal Message, Len(Message))
cds.dwData = 0
cds.cbData = Len(Message) + 1
cds.lpData = VarPtr(buf(1))
' Send the string.
Dim i As Long
i = SendMessage(lHwnd, WM_COPYDATA, MainForm.hwnd, cds)
can anyone tell me what am doing wrong?