Wie bau ich das bezogen auf diesen Code ein?
Sender:
Code:
Code:
procedure TForm1.FormCreate(Sender: TObject);
var
aCopyData: TCopyDataStruct;
p: PChar;
begin
p := 'Hallo!';
with aCopyData do begin
dwData := 0;
cbData := StrLen(p) + 1;
lpData := p;
end;
SendMessage(FindWindow('TFormRecv', nil), WM_COPYDATA, Longint(
Handle),
Longint(@aCopyData));
Application.Terminate;
end;
Receiver:
Code:
Code:
type
TFormRecv = class(TForm)
private
procedure WMCopyData(var Msg: TWMCopyData); message WM_COPYDATA;
end;
// ...
procedure TFormRecv.WMCopyData(var Msg: TWMCopyData);
begin
ShowMessage(String(Msg.CopyDataStruct.lpData));
end;