P pbz Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-12 #1 我想获得某个存在文件夹的路径,但opendialog只能获得某个文件的路径。请问怎办?
L lb_icesea79 Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-12 #2 ExtractFilePath(OpenDialog1.FileName);
M Ming618 Unregistered / Unconfirmed GUEST, unregistred user! 2002-10-12 #3 可用以下方法:<br>SelectDirectory('请选择一个目录用来保存备份文件', '备份目录', Directory1);
Y yyhhan Unregistered / Unconfirmed GUEST, unregistred user! 2003-07-04 #6 procedure TForm1.Button2Click(Sender: TObject);<br>begin<br> showmessage('程序名称包括完整路径='+Application.ExeName);<br> showmessage('程序文件名='+ExtractFileName(Application.ExeName));<br> showmessage('程序的扩展名='+ExtractFileExt(Application.ExeName));<br> showmessage('驱动器='+ExtractFileDrive(Application.ExeName));<br> showmessage('程序路径,未尾带''/'' ='+ExtractFilePath(Application.ExeName));<br> showmessage('程序路径,未尾不带''/'' ='+ExtractFileDir(Application.ExeName));<br>end;<br>呵呵,想要什么有什么。
procedure TForm1.Button2Click(Sender: TObject);<br>begin<br> showmessage('程序名称包括完整路径='+Application.ExeName);<br> showmessage('程序文件名='+ExtractFileName(Application.ExeName));<br> showmessage('程序的扩展名='+ExtractFileExt(Application.ExeName));<br> showmessage('驱动器='+ExtractFileDrive(Application.ExeName));<br> showmessage('程序路径,未尾带''/'' ='+ExtractFilePath(Application.ExeName));<br> showmessage('程序路径,未尾不带''/'' ='+ExtractFileDir(Application.ExeName));<br>end;<br>呵呵,想要什么有什么。
W WorldCreater Unregistered / Unconfirmed GUEST, unregistred user! 2003-07-04 #7 文件夹和文件名一样的,调用他们说的函数就成了,<br>比如文件夹名为 c:/a/b/c/d<br>extractfilepath后就得到c:/a/b/c<br>就是d文件夹的路径
W WorldCreater Unregistered / Unconfirmed GUEST, unregistred user! 2003-07-04 #8 selectdirectory<br>不知有没写错,你查查帮助,<br>可以获得一个文件夹
城 城市猎人^-^ Unregistered / Unconfirmed GUEST, unregistred user! 2003-07-04 #9 ExtractFilePath(OpenDialog1.FileName);一句话就能搞定干嘛那么麻烦!
A aolo Unregistered / Unconfirmed GUEST, unregistred user! 2003-07-04 #10 得到文件夹的路径:用SelectDirectory函数即可定位文件夹!<br><br>
A aolo Unregistered / Unconfirmed GUEST, unregistred user! 2003-07-04 #11 function SelectDirectory(const Caption: string; const Root: WideString;<br>out Directory: string): Boolean;<br>其中:Caption:对话框的标题<br> Root:根路径,c:/,d:/,''<br> Directory:返回选择的路径<br><br>
function SelectDirectory(const Caption: string; const Root: WideString;<br>out Directory: string): Boolean;<br>其中:Caption:对话框的标题<br> Root:根路径,c:/,d:/,''<br> Directory:返回选择的路径<br><br>