我的EXE文件后面有参数,我要在DELPHI中调用这个EXE.但执行后, 发现参数的做用没起到.
WinExec('D:\eserver.exe 10.0.0.2 55970 10.0.0.2 55960 51898', SW_Normal);shellexecute(Application.Handle,'open','D:\eserver.exe  10.0.0.2 55970 202.101.62.42 55960 51898','D:\ver\9.lnk','',sw_show);这两种方法都不行.第一种是运行了,但参数没起做用.第二种是没运行.

解决方案 »

  1.   

    你再run里面怎么加参数,这里就怎么加例如  ping -a 127.0.0.1
      

  2.   

    shellexecute(Application.Handle,'open','D:\eserver.exe',' 10.0.0.2 55970 202.101.62.42 55960 51898','',sw_show);
      

  3.   

    还是不行啊.
    我按 yufei_lgq(光光) 的说法做了,还是不行啊.
      

  4.   

    shellexecute(form1.Handle,'open',pchar('shutdown.exe'),'','/?',sw_shownormal);//这就可以呀,你执行一下就会看到,只不过窗口一闪就过去了
      

  5.   

    一方面要传入,如回复的朋友们写
    另一方面要接收如下:
    被打开的程序中的ONCREATE事件中:
    begin
      showmessage(inttostr(paramcount));//即显示你传入参数的个数
      showmessage(paramstr(1));  //为你传入参数的内容
    end;
      

  6.   

    lianshaohua(永远深爱一个叫“然”的好女孩儿!) 
    为什么会一闪就过去了呢.你写的那个里.
    shellexecute(form1.Handle,'open',pchar('shutdown.exe'),'','/?',sw_shownormal);//
    pchar是什么意思.不好意思,我不懂DELPHI.
      

  7.   

    楼主自己的问题吧
    测试一下就知道了,我是这样测试的 
    就是有参数的那个程序的onshow事件里写上caption := paramstr(1)+','+paramstr(2);
    然后新建一个程序,弄一个按钮,写上单击事件
    procedure TForm1.Button1Click(Sender: TObject);
    var
      str : string;
    begin
      str := '"'+ '=========有参数程序的路径============'+'"';
      shellexecute(Handle,'open',pchar(str),'afdsafdsaf fsadf','',sw_show);
    end;这样是可以的,楼主再看一下,哪有问题
      

  8.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      SystemPath:string;
    begin
       SystemPath := GetCurrentDir;
      ShellExecute(application.Handle,'open',PChar(SystemPath+'\RepCenterP.exe'),'-s','',SW_SHOWNORMAL);
    end;
    getcurrentdir是获得EXE文件的当前路径.
    repcenterp.exe是你要调用的EXE文件路径.
    Pchar只是一个函数.