段代码手工折叠

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

关于exe文件传递参数方法的更多相关文章

  1. python制作exe可执行文件的方法---使用pyinstaller

    python制作exe可执行文件的方法---使用pyinstaller   python生成windows下exe格式的可执行程序有三种可选方案: py2exe是大家所熟知的,今天要介绍pyinsta ...

  2. Action接收页面传来的参数方法

    接收页面传来的参数方法 1.第一种:在action中设置相应的变量 在相应的action中设置与将要传进来的参数名相同的变量 eg: 页面传给后台两个参数 name=chance & age ...

  3. C# 中的可变参数方法(VarArgs)

    首先需要明确一点:这里提到的可变参数方法,指的是具有 CallingConventions.VarArgs 调用约定的方法,而不是包含 params 参数的方法.可以通过MethodBase.Call ...

  4. C#调用Exe文件的方法及如何判断程序调用的exe已结束

    很简单的代码就可以实现C#调用EXE文件,如下: 引入using System.Diagnostics; 调用代码: Process.Start(exe文件名); 或直接 System.Diagnos ...

  5. Asp.Net读取服务器EXE文件的方法!(超简单实例)

    Asp.Net读取服务器EXE文件的方法!(超简单实例) Process process = new Process(); process.StartInfo.FileName = "d:\ ...

  6. 【功能代码】---4用JS获取地址栏参数方法

    用JS获取地址栏参数方法 // 方法一:采用正则表达式获取地址栏参数:( 强烈推荐,既实用又方便!) function GetQueryString(name) { var reg = new Reg ...

  7. SSM-SpringMVC-11:SpringMVC中ParameterMethodNameResolver参数方法名称解析器

    ------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥------------- 或许曾经的我们也见过一种方式http://localhost:8080/项目名/后台servlet?actio ...

  8. RhinoMock中无参数方法和无返回值方法的使用

    无返回值方法,RhinoMock的例子是这么做的: demo.VoidThreeArgs(, "", 0f); LastCall.On(demo).Callback<int, ...

  9. JavaScript&jQuery获取url参数方法

    JavaScript&jQuery获取url参数方法 function getUrlParam(name){ var reg = new RegExp("(^|&)" ...

随机推荐

  1. Linux 软件安装到哪里合适,目录详解

    文章来源: https://blog.csdn.net/qq_22771739/article/details/83933473 Linux 的软件安装目录是也是有讲究的,理解这一点,在对系统管理是有 ...

  2. Nginx 模块 - ngx_http_rewrite_module

    原文地址 ngx_http_rewrite_module 模块用于通过 PCRE 正则表达式改变请求 URI,返回重定向并可以有条件地选择配置. break.if.return.rewrite 以及 ...

  3. python time 和日期相关模块

    时间日期相关的模块 calendar 日历模块 time 时间模块 datetime 日期时间模块 timeit 时间检测模块 日历模块 calendar() 功能:获取指定年份的日历字符串 格式:c ...

  4. 转载 IDEA搭建maven项目详细步骤(解决没有src及其下面的文件)

    转载自

  5. Linux系统配置Java开发基本环境

    jdk安装一.用yum安装jdk1.查看yum库都有哪些jdk版本yum search java|grep jdk2.选择版本安装yum install java-1.8.0-openjdk(/usr ...

  6. [CF453C] Little Poney and Summer Sun Celebration (思维)

    [CF453C] Little Poney and Summer Sun Celebration (思维) 题面 给出一张N个点M条边的无向图,有些点要求经过奇数次,有些点要求经过偶数次,要求寻找一条 ...

  7. [洛谷P3261] [JLOI2015]城池攻占(左偏树)

    不得不说,这道题目是真的难,真不愧它的“省选/NOI-”的紫色大火题!!! 花了我晚自习前半节课看题解,写代码,又花了我半节晚自习调代码,真的心态爆炸.基本上改得和题解完全一样了我才过了这道题!真的烦 ...

  8. each of which 用法

    each of which 在以下為 同位語,非關代. 1. An urn contains two balls, each of which is known to be either white ...

  9. Topcoder SRM653div2

    A . 250 Problem Statement      Some people are sitting in a row. Each person came here from some cou ...

  10. 怎么区分PV、IV、UV以及网站统计名词解释(pv、曝光、点击)

    PV(Page View)访问量,即页面访问量,每打开一次页面PV计数+1,刷新页面也是. IV(Internet Protocol)访问量指独立IP访问数,计算是以一个独立的IP在一个计算时段内访问 ...