ShellExecute
我在C++Builder中用 ShellExecute(0, "Open", ExeName.c_str(),"abc",NULL,SW_SHOW); 然后在Delphi中用
end;
procedure TMainForm.FormCreate(Sender: TObject);
var
hsList: THashedStringList;
I: Integer;
begin
hsList := THashedStringList.Create;
try
for I := 1 to ParamCount - 1 do
begin
hsList.Add(ParamStr(i));
end;
ShowMessage(hsList.Text);
finally
hsList.Free;
end;
end;
怎么接收不到参数abc,还有个问题,就是我要发送多个参数时是什么格式的
[解决办法]
ExeName最后加个空格试试
===================
如果没有特殊需要, 只是要在程序中启动另一个程序, 用
ShellExecute(NULL, NULL, "c:\\winnt\\notepad.exe ", "d:\\11.txt ", NULL, SW_SHOWNORMAL);
更方便了
或者更简单的, 用winexec
WinExec( "c:\\winnt\\notepad.exe d:\\11.txt ", SW_SHOWNORMAL);