段代码手工折叠

{$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

最新文章

  1. LoadRunner 11 安装步骤
  2. oracle 修改密码
  3. Windows内核遍历驱动模块源码分析
  4. TinyFrame升级之十:WCF Rest Service注入IOC的心
  5. NOIP2008提高组(前三题) -SilverN
  6. CSS布局属性
  7. 整理:Google jQuery 引用地址大全和方法(转)
  8. spring aop切面配置
  9. python ciscolib模块
  10. Redis实战 - 5事务:multi、exec和watch
  11. NodeJs 学习笔记(一)Wedding 项目搭建
  12. luogu P4899 [IOI2018] werewolf 狼火
  13. MySQL InnoDB加锁超时回滚机制(转)
  14. Oracle EBS GL 总账日记账打开报错此职责无可用函数
  15. Windows7下Java运行时环境搭建
  16. IntelliJ IDEA windows与mac下常用快捷键
  17. Mybatis增删改查(CURD)
  18. kubeadm init 时从本地私有仓库下载镜像
  19. 自己写bootloader(一)
  20. Nodejs 天涯帖子《鹿鼎记中计》 柳成萌著 下载爬虫

热门文章

  1. Flask框架视图多层装饰器问题
  2. jmeter3.0+ant1.10+jenkins实现接口自动化并发送邮件
  3. 软件体系结构-分层、代理、MVC、管道与过滤器
  4. JavaScript高级程序设计(第3版) 第四章(变量、作用域和内存问题)
  5. div在上一层容器居中的方法
  6. JAVA模拟Spring实现IoC过程(附源码)
  7. each of which 用法
  8. 浅谈随机数发生器(C语言)
  9. C# 值类型与引用类型的详解
  10. Windows程序设计--(四)文本输出