| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 3267 人关注过本帖
标题:Delphi获取程序自身路径
取消只看楼主 加入收藏
yangguofa
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2004-5-5
收藏
 问题点数:0 回复次数:0 
Delphi获取程序自身路径

Delphi 提供了分析文件名的多个函数,如果你需要从文件名中得到路径名,可用下面的两个函数,这两个函数有一点点微小的差别:

  ExtractFilePath(FileName:String) 该函数返回路径名,其结尾字符总是“\

 ExtractFileDir(FileName:String) 该函数同样返回路径名,但不包括结尾的字符“\”,除非返回的路径是根目录。 

样例代码:

 procedure TForm1.Button1Click(Sender: TObject);

  begin

  ShowMessage(ExtractFileDir(Application.Exename)); // : c:\temp

  ShowMessage(ExtractFilePath(Application.Exename)); // : c:\temp\   

end;


/bbs/UploadFile/2005-3/2005320191459674.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www./bbs/UploadFile/2005-3/2005320191459674.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2004-05-19 10:43
快速回复:Delphi获取程序自身路径
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025222 second(s), 10 queries.
Copyright©2004-2025, BC-CN.NET, All Rights Reserved