本文整理自网络,侵删。
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 enumwindows 获取窗体句柄 进程id 窗体信息
Delphi获取flash文件的影片时长,原始尺寸,帧数等信息
Delphi xe [dcc32 fatal error] f2039 could not create output file 问题的解决
更多相关阅读请进入《Delphi》频道 >>