Einzelnen Beitrag anzeigen

Benutzerbild von d3g
d3g

Registriert seit: 21. Jun 2002
602 Beiträge
 
#6
  Alt 6. Sep 2002, 21:55
Hi Thomas,

Sender:

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:
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;
MfG,
d3g
-- Crucifixion?
-- Yes.
-- Good. Out of the door, line on the left, one cross each.
  Mit Zitat antworten Zitat