测试通过了,给你代码。工程文件:program Project1;uses Forms, Windows, Unit1 in 'Unit1.pas' {FrmXZN};{$R *.res}Var H:HWND; I:Integer;begin H:=FindWindow('TFrmXZN',nil); if H<>0 Then begin For I:=1 to ParamCount Do PostOpenFile(H, ParamStr(I) ); Exit; end; Application.Initialize; Application.CreateForm(TFrmXZN, FrmXZN); Application.Run;end.----------------------------------单元文件:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TFrmXZN = class(TForm) Memo1: TMemo; procedure FormCreate(Sender: TObject); private { Private declarations } procedure MyMessage(var t:TWMCopyData);Message WM_COPYDATA; public { Public declarations } end;var FrmXZN: TFrmXZN;procedure PostOpenFile(H: HWND; FileName: string);implementation{$R *.dfm}procedure TFrmXZN.FormCreate(Sender: TObject);var I: Integer;begin for I := 1 to ParamCount do caption := caption + ' ' + ParamStr(I);end;procedure PostOpenFile(H: HWND; FileName: string);var DS: TCopyDataStruct;begin ShowMessage('发送:' + FileName); Ds.cbData := Length(FileName) + 1; GetMem(Ds.lpData, Ds.cbData); StrCopy(ds.lpData, PChar(FileName)); SendMessage(H, WM_COPYDATA, Application.Handle, Cardinal(@ds)); FreeMem(Ds.lpData);end;procedure TFrmXZN.MyMessage(var t: TWMCopyData);var tmpStr:String;begin //接受消息并显示。 tmpStr:=StrPas(t.CopyDataStruct^.lpData); Memo1.Lines.Add(tmpStr);end;