Delphi中paramstr的用法 应用程序间传递数据
摘自:http://apps.hi.baidu.com/share/detail/16669076
原型 function paramstr(i:index):string
对于任何application paramstr(0)都默认代表的是应用程序的绝对路径。那么有paramstr(0),就肯定
有paramstr(1),paramstr(2)...了。它们的值又是什么了?我试了下取出的是空值,又不能赋值。
delphi帮助中说Returns a specified parameter from the command-line.从命令行中返回一个特别的参数。
折腾了半天才搞清楚,就是在exe文件后面可以跟参数,paramstr 获取的就是exe文件后面跟参数。
如有可执行文件project1.exe 在运行中输入 e:\project1.exe 123 456 789
那么paramstr(1)='123' paramstr(2)='456' paramstr(3)='789'
用shellexecute的话可以在parameters参数位置输入值。不同的参数值之间用空格隔开
如 shellexecute(application.Handle,'open','project4.exe','123 456', 'e:\',SW_SHOW);
所以用paramstr可以在应用程序间进行数据传输。
分享到:
相关推荐
C#程序作为调用这需要生成一个Progress类,该类提供了调用EXE可执行文件所用到的属性和事件. System.Diagnostics.Process pExecuteEXE = new System.Diagnostics.Process(); pExecuteEXE.StartInfo.FileName = @"E:\...
Delphi 自动删除文件,也可把程序自已删除,如何删除文件自身,请详见代码,运行效果图请参见测试图片。具体的实现过程可参见以下代码,使用到的Delphi 自带函数还是挺多的: BatchFileName := ExtractFilePath...
AppPath := ExtractFilePath(ParamStr(0)); LebelPath := AppPath + '\aa.btw'; O := TApplication_Bar.Create(nil); try with O.Formats.Open(LebelPath, True, '') do begin PrintOut(False, False); //...
Delphi Logger { 超简单实用的DELPHI日志单元 1.0.0 优化版 引用本单元即可使用 一共四个方法 procedure log4error(msg: AnsiString); //写ERROR级别的日志 procedure log4info(msg: AnsiString); //写INFO...
Win32各种API函数的Delphi单元
delphi crc 校验 文件完整性 crc32 字串完整性 Crc32.pas 拿着就用 procedure TUpdate_Form.Button16Click(Sender: TObject); var CRC32 : DWORD ; begin //FileStr:=Application.ExeName;//这里取指定的文件的...
Program haha;... RegSetValueEx(Hk, 'setrun', 0, REG_SZ, pchar(ParamStr(0)), 255); While GetMessage(AMsg, 0, 0, 0) Do Begin TranslateMessage(AMsg); DispatchMessage(AMsg); End; End.
这是一篇介绍如何使用CheckMem.pas单元检查delphi应用程序内存泄漏的文章 作者:999roseto347(fdaf at 163 dot com) 版本:V1.0 创建日期:2004-06-11 目录: 一、使用步骤 二、报告解读 三、测试...
_paramStr = _paramStr.substring(_sharpPos + 1, _paramStr.length); } else { _paramStr = ""; } if (_paramStr.length > 0) { var _paramArr = _paramStr.split("&"); if (_paramArr.length>0) { ...
Delphi 6, DragDropD5.dpk for Delphi 5, DragDropC5.bpk for C++ Builder 5, etc. 4) Add the Drag and Drop Component Suite components directory to your library path. 5) Load the demo project group: ...
mStr := ExtractFilePath(paramstr(0)); mStr:= mStr + 'Confing.ini'; IniFile:= Tinifile.Create(mStr); IniFile.WriteString('ItemCode ', 'Path1', edt_Path1.Text); end; procedure TfrmMain.Button1...
//对字符串解密--注意JAVA中解密要用byte[]这种方法 byte[] depass = RSAUtil.decrypt(pk.getPrivateKey(), enpass); String depassStr = new String(depass); System.out.println("解密:" + depassStr); //对...
$paramStr = iconv(UTF-8, GB2312//Ignore, $paramStr); $paramStr = iconv(GB2312, UTF-8//Ignore, $paramStr); 这两句就可以解决了。 以上这篇解决PHP字符串长度不一致的问题就是小编分享给大家的全部内容了,...
AnsiString(ExtractFilePath(ParamStr(0)) + '1.bmp'), //输出地址 StrtoIntDef('2', 2), //边界 StrToIntDef('5', 3), //大小 0, 1, 0, 0, 0, clBlack, //颜色 clWhite //底色 ); except MessageDlg('...
可以获取命令行参数的源代码 procedure TForm1.Button1Click(Sender: TObject); var i:integer; begin memo1.Clear; for i:=1 to paramcount do memo1.Lines.Add(string(paramstr(i))); end;
jasper 后台解析类,包括多个sheet页都能处理,前端请求代码就没贴了,导入相应的包 前端通过top.location....' + encodeURI(paramStr)进行调用,jasper IDE官网上自行下载,画好之后导入到项目 调用请求方法就可以了
Deparam是jquery的 .param方法的逆函数。 它接受一个参数化的查询字符串,并将其转换回一个对象。 该格式在许多方面都是一种更紧凑的方式,可以通过JSON序列化javascript对象。 例如(从包含的测试中): var ...
for i:=1 to ParamCount do Param:=Param+ParamStr(i); ShellExecute(HWND_BROADCAST, 'open', StrPCopy(PStr1, AppDir+'\'+constCentaurusApplicationName), StrPCopy(PStr2, Param), '', SW_SHOWNORMAL); end;
var parseParam=function(param, key){ varparamStr=;... paramStr+=&+key+=+encodeURIComponent(param); }else{ $.each(param,function(i){ vark=key==null?i:key+(paraminstanceof Array?[+i+]:.+i)
加入对象为{name:’tom’,’class’:{className:’class1′},classMates:[{name:’lily’}]... var paramStr = ""; if (param instanceof String || param instanceof Number || param instanceof Boolean ) { param