关于exe文件传递参数方法
2024-09-05 13:19:25
段代码手工折叠
{$REGION 'Designer Managed Code'}
............
{$ENDREGION}
昨天同事问到,delphi里exe文件如何传递参数?
因为手头装了Delphi,PowerBuilder
以下就是代码:
Delphi:
procedure TForm1.FormCreate(Sender: TObject);
var
i: Integer;
begin
for i:= to ParamCount do
begin
if LowerCase(ParamStr(i)) = 'beep' then
Application.MessageBox('Demo','beep',IDOK )
else if LowerCase(ParamStr(i))='exit' then
Application.Terminate;
end;
end;
PowerBuilder:
string ls_cmd, ls_arg[] integer i, li_argcnt // Get the arguments and strip blanks
// from start and end of string
ls_cmd = Trim(CommandParm()) li_argcnt =
DO WHILE Len(ls_cmd) > // Find the first blank
i = Pos( ls_cmd, " ") // If no blanks (only one argument),
// set i to point to the hypothetical character
// after the end of the string
if i = then i = Len(ls_cmd) + // Assign the arg to the argument array.
// Number of chars copied is one less than the
// position of the space found with Pos
ls_arg[li_argcnt] = Left(ls_cmd, i - ) // Increment the argument count for the next loop
li_argcnt = li_argcnt + // Remove the argument from the string
// so the next argument becomes first
ls_cmd = Replace(ls_cmd, , i, "") LOOP
使用:
*.exe beep exit
最新文章
- LoadRunner 11 安装步骤
- oracle 修改密码
- Windows内核遍历驱动模块源码分析
- TinyFrame升级之十:WCF Rest Service注入IOC的心
- NOIP2008提高组(前三题) -SilverN
- CSS布局属性
- 整理:Google jQuery 引用地址大全和方法(转)
- spring aop切面配置
- python ciscolib模块
- Redis实战 - 5事务:multi、exec和watch
- NodeJs 学习笔记(一)Wedding 项目搭建
- luogu P4899 [IOI2018] werewolf 狼火
- MySQL InnoDB加锁超时回滚机制(转)
- Oracle EBS GL 总账日记账打开报错此职责无可用函数
- Windows7下Java运行时环境搭建
- IntelliJ IDEA windows与mac下常用快捷键
- Mybatis增删改查(CURD)
- kubeadm init 时从本地私有仓库下载镜像
- 自己写bootloader(一)
- Nodejs 天涯帖子《鹿鼎记中计》 柳成萌著 下载爬虫