1、内存映射
2、用消息发送数据:WM_COPYDATA
3、互斥空间(Mutex)
4、Socket
5、剪贴板
6、自动化对象(LPC/RPC)
7、ORB
不过用WM_COPYDATA最简单。例子如下:
uses ShellAPI;
......
private
procedure ReceiveData(var Message: TWMCopyData);
message WM_COPYDATA;
......
发送:
var
lcdsFile: TCopyDataStruct;
lsFile: string;
begin
with lcdsFiledo
begin
dwData:= 自定义其它参数;
cbData:= Length(lsFile) + 1;
lpData:= @lsFile[1];
end;
SendMessage(hWnd, WM_COPYDATA, 0, LPARAM(@lcdsFile));
end;
......
接收:
procedure TfrmFrame.ReceiveData(var Message: TWMCopyData);
var
lsTemp: string;
begin
with message.CopyDataStruct^do
if dwData = 自定义其它参数 then
lsTemp := StrPas(PChar(lpData));
end;