本文整理自网络,侵删。
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中如何捕获mediaplayer播放的视频中的每一帧 ?
Delphi strutils.dupestring - 反复字符串
Delphi 实现卸载windows应用程序(类似360软件管家-卸载程序)
更多相关阅读请进入《Delphi》频道 >>