目录选择对话框
来源:互联网 发布:非零矩阵 编辑:程序博客网 时间:2024/06/08 02:41
uses ShlObj;
function SelectDirectory(Handle: hwnd; const Caption: string;
const Root: WideString; out Directory: string): Boolean;
var lpBI: _BrowseInfo;
Buf: array[0..MAX_PATH] of char;
ID: IShellFolder;
Eaten, Att: Cardinal;
rt: pItemIDList;
initdir: PWideChar;
begin
Result := False;
lpbi.hwndOwner := Handle;
lpbi.lpfn := nil;
lpbi.lpszTitle := PChar(Caption);
lpbi.ulFlags := BIF_RETURNONLYFSDIRS + BIF_EDITBOX;
SHGetDesktopFolder(ID);
initdir := PWChar(Root);
ID.ParseDisplayName(0, nil, InitDir, Eaten, rt, Att);
lpbi.pidlRoot := rt;
GetMem(lpbi.pszDisplayName, MAX_PATH);
try
Result := SHGetPathFromIDList(SHBrowseForFolder(lpbi), buf);
except
FreeMem(lpbi.pszDisplayName);
end;
if result then begin
Directory := buf;
if Length(Directory) <> 3 then
Directory := Directory + '';
end;
end;
function SelectDirectory(Handle: hwnd; const Caption: string;
const Root: WideString; out Directory: string): Boolean;
var lpBI: _BrowseInfo;
Buf: array[0..MAX_PATH] of char;
ID: IShellFolder;
Eaten, Att: Cardinal;
rt: pItemIDList;
initdir: PWideChar;
begin
Result := False;
lpbi.hwndOwner := Handle;
lpbi.lpfn := nil;
lpbi.lpszTitle := PChar(Caption);
lpbi.ulFlags := BIF_RETURNONLYFSDIRS + BIF_EDITBOX;
SHGetDesktopFolder(ID);
initdir := PWChar(Root);
ID.ParseDisplayName(0, nil, InitDir, Eaten, rt, Att);
lpbi.pidlRoot := rt;
GetMem(lpbi.pszDisplayName, MAX_PATH);
try
Result := SHGetPathFromIDList(SHBrowseForFolder(lpbi), buf);
except
FreeMem(lpbi.pszDisplayName);
end;
if result then begin
Directory := buf;
if Length(Directory) <> 3 then
Directory := Directory + '';
end;
end;
- 目录选择对话框
- 临时选择目录对话框
- 目录选择对话框
- 目录选择对话框
- 目录选择对话框
- 目录选择对话框
- 目录选择对话框
- VC++选择目录对话框
- MFC选择目录对话框
- SHBrowseForFolder目录选择对话框
- 选择目录对话框和选择文件对话框
- 选择目录对话框和选择文件对话框
- 选择目录对话框和选择文件对话框
- 选择目录对话框和选择文件对话框
- vs2010MFC选择文件对话框,选择目录对话框
- 选择目录对话框,选择文件对话框
- 选择目录对话框和选择文件对话框
- 选择目录对话框和选择文件对话框
- delphi内如何检测用户多长时间没有鼠标与键盘操作?
- hibernate 做数据连接池的几种方式
- SQL Server 安装时报有文件被挂起,不能安装
- IIS 启动不了 【发生意外错误0x8ffe2740】
- 使用IdHTTP的问题 Object Moved
- 目录选择对话框
- MiddlegenIDE的使用
- 使用ShLwApi中的PathCompactPathEx进行路径压缩显示
- delphi内进行音量控制及静音
- Delphi中如何准确截取汉字
- 读书笔记--构造函数和复制控制
- asp.net中使用Cookie时用中文汉字引起的乱码
- 在Delphi7内取网卡MAC地址
- SQL Server在存储过程内引用返回数据集的存储过程