I successfully send message cross apps. But the code doesn’t work in FMX. I can find the FMX form but no message receive at dest.
Sender code:
CDS.dwData:= 0; //Identify message
CDS.cbData:= ByteLength(Str);
CDS.lpData:= PChar(Str);
if DstHandle=0 then
DstHandle := Winapi.Windows.FindWindow(nil, PChar(TargetFormCaption));
if DstHandle<>0 then
begin
Res := SendMessage(DstHandle, WM_COPYDATA, Handle, NativeInt(@CDS));
Result:= True;
end
else
Result:= False;
Result is true but WMGetData is not triggered.
Receiver code:
procedure WMGetData(var Msg : TWMCopyData) ; message WM_COPYDATA;
…
procedure TForm3.WMGetData(var Msg: TWMCopyData);
begin
Caption:= ‘Got something !’;
end;