"C:\Program Files\Mozilla Firefox\firefox.exe"
有时候看见有带参数的如
"C:\Program Files\Mozilla Firefox\firefox.exe auto "
有什么办法得到后面的参数

解决方案 »

  1.   

    程序接收参数
      //ShowMessage(inttostr(ParamCount));
      if ParamCount = 1 then
      begin
        ShowMessage(ParamStr(1));
      end
      }
      

  2.   

    kinglh(用Delphi想BCB)
    能否详细点
      

  3.   

    Delphi帮助自带的例子:
    procedure TForm1.FormCreate(Sender: TObject);var
      i: Integer;
      for i := 1 to ParamCount do'取得参数个数为循环数
      begin
        if LowerCase(ParamStr(i)) = 'beep' then'如果参数为beep,则计算机鸣叫一次
          Beep
        else if LowerCase(ParamStr(i)) = 'exit' then'如果参数为exit,结束程序
          Application.Terminate;
      end;
    end;
      

  4.   

    Delphi帮助自带的例子:
    procedure TForm1.FormCreate(Sender: TObject);var
      i: Integer;
      for i := 1 to ParamCount do  //取得参数个数为循环数
      begin
        if LowerCase(ParamStr(i)) = 'beep' then  //如果参数为beep,则计算机鸣叫一次
          Beep
        else if LowerCase(ParamStr(i)) = 'exit' then //如果参数为exit,结束程序
          Application.Terminate;
      end;
    end;
      

  5.   

    system.pas中有4个相关于参数的函数,
    去帮助里看CmdLine variablePoints to the command-line arguments specified when the application is invoked.FindCmdLineSwitch functionDetermines whether a string was passed as a command line argument to the application.ParamCount functionReturns the number of parameters passed on the command line.ParamStr functionReturns a specified parameter from the command-line.
      

  6.   

    在WINNT可能用NTQUERYINFORMATION得到进程的动行参数!这在C语言早就有了,我就是改过来的哦!
      

  7.   

    shuiying()正解
    不过Delphi帮助自带的例子有点小失误:
    procedure TForm1.FormCreate(Sender: TObject);var
      i: Integer;
    begin
      for i := 1 to ParamCount do  //取得参数个数为循环数
      begin
        if LowerCase(ParamStr(i)) = 'beep' then  //如果参数为beep,则计算机鸣叫一次
          Beep
        else if LowerCase(ParamStr(i)) = 'exit' then //如果参数为exit,结束程序
          Application.Terminate;
      end;
    end;