本文整理自网络,侵删。
type
TMyRecord = packed record
b: Boolean; s: string[255];
end;
PMyRecord = ^TMyRecord;
procedure TForm1.Button1Click(Sender: TObject);
var
MyRecord: PMyRecord;
cds: TCopyDataStruct;
hWnd: THandle;
begin
GetMem(MyRecord, sizeof(TMyRecord));
try
MyRecord.b := True;
MyRecord.s := 'Hello world';
cds.dwData := 0;
cds.cbData := sizeof(TMyRecord);
cds.lpData := MyRecord;
hWnd := FindWindow(nil, 'Receiver');
SendMessage(hWnd, WM_COPYDATA, Handle, Integer(@cds));
finally
FreeMem(MyRecord, sizeof(TMyRecord));
end;
end;
相关阅读 >>
Delphi xe5 android 开发实现手机打电话和发短信
Delphi unigui unistringgrid1 清空
更多相关阅读请进入《Delphi》频道 >>