"C:\Program Files\Mozilla Firefox\firefox.exe"
有时候看见有带参数的如
"C:\Program Files\Mozilla Firefox\firefox.exe auto "
有什么办法得到后面的参数
有时候看见有带参数的如
"C:\Program Files\Mozilla Firefox\firefox.exe auto "
有什么办法得到后面的参数
解决方案 »
- 怎样把一个字符串的公式转换成实际的公式
- 求个sql复杂句子,头有点晕想不出了大家给个法子。
- 怎样实现类似qq弹出的效果,在线等
- 如何只通过D中的组件实现客户端与服务端的数据交换(加分100)
- 多表查询问题?
- Delphi中如何实现GIF图形的缩放和拖拽?就象ACDsee 32一样?
- 谁有写好的DES 和3DES 函数 或DLL ?
- 求救!!!!
- 有搞底层通讯,知道TMSComm,和MSCommLib_TLB单元的兄弟吗?告诉我那里可以找到这些东西!分马上给!waiting!
- ComboBox多个值的初使化,怎么做?
- TREEVIEW节点
- 急死我了,简单问题,哪位大虾出手相助,帮我解决的另加20分.
//ShowMessage(inttostr(ParamCount));
if ParamCount = 1 then
begin
ShowMessage(ParamStr(1));
end
}
能否详细点
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;
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;
去帮助里看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.
不过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;