Delphi如何实现浏览文件夹


本文整理自网络,侵删。

 Delphi如何实现浏览文件夹

SelectDirectory函数(FileCtrl单元)
1、function SelectDirectory(const Caption: string; const Root: WideString; out Directory: string): Boolean; overload;
2、function SelectDirectory(var Directory: string; Options: TSelectDirOpts; HelpCtx: Longint): Boolean; overload;
注意:使用前请uses FileCtrl;
第1种调用格式示例为:
const
sCaption = '文件夹'; //弹出框标题名(非弹出框窗体名)
sRoot = ''; //初始文件夹(如'C:\','D:\DownLoad'等, 不存在则从桌面)
var
sDir: string;
begin
if SelectDirectory(sCaption, sRoot, sDir) then
//已返回所选文件夹路径给sDir,自行处理
end;
结果下图:


第2种调用格式示例为:
const
SELDIRHELP = 1000;
var
sDir: string; //初始文件夹(如'C:\','D:\DownLoad'等)
begin
sDir := '';
if SelectDirectory(Dir, [sdAllowCreate, sdPerformCreate, sdPrompt], SELDIRHELP) then
//已返回所选文件夹路径给sDir,自行处理
end;

相关阅读 >>

Delphi 搜索内存偏移函数

Delphi topendialog打开和取消按钮的选择

Delphi版多开源码,也就是遍历系统内核对象句柄

Delphi listview高速添加数据

Delphi 调用cmd获取java 版本号

Delphi fmx中获取窗口比例

Delphi xe6 取得app自己的版本号(横跨4个平台)

Delphi利用系统环境变量获取常用系统目录

winapi 字符及字符串函数(2): charlowerbuff - 把缓冲区中指定数目的字符转小写

Delphi 简单的字符串加密和解密

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...