unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type _MyRecord = record Int: Integer; Name: string[50]; end; PMyRecord = ^_MyRecord; TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } procedure MyMessage(var t: TWMCopyData); Message WM_COPYDATA; public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure PostInfoToOther(H: HWND; AInfo: _MyRecord);var DS: TCopyDataStruct;begin Ds.cbData := Sizeof(AInfo); GetMem(Ds.lpData, Ds.cbData); PMyRecord(Ds.lpData)^ := AInfo; SendMessage(H, WM_COPYDATA, Application.Handle, Cardinal(@ds)); FreeMem(Ds.lpData);end;{ TForm1 }procedure TForm1.MyMessage(var t: TWMCopyData);var Info:_MyRecord;begin Info := PMyRecord(t.CopyDataStruct.lpData)^; ShowMessage( Info.Name );end;procedure TForm1.Button1Click(Sender: TObject);var test:_MyRecord;begin test.Int:=30; test.Name:='ZNXIA'; PostInfoToOther(Self.Handle,test);//测试,就直接发给当前窗体句柄了,发给其它窗体也一样,呵呵end;end.===================给分,嘿嘿