怎样能够弹出“浏览文件夹”的对话框,用来选择文件夹?

lnliliang 2002-01-25 06:14:14
调用什么函数能够弹出“浏览文件夹”的对话框,我在delphi中没看到有类似的控件,但是很多应用软件都能够显示同样的“浏览文件夹”的对话框,用来选择文件夹。
谁能告诉我!!!
...全文
322 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
jianghuxiaozi 2002-01-26
  • 打赏
  • 举报
回复
selectdirector
lnliliang 2002-01-26
  • 打赏
  • 举报
回复
弹出窗口的位置怎么指定,他怎么总是出现在屏幕的右下角啊,怎么能够让它出现在屏幕中央。
chenbin 2002-01-26
  • 打赏
  • 举报
回复
uses ShlObj;

//SelectDir(句柄,提示的文字,打开时默认的目录,返回文件路途变量):成功否.
function SelectDir(ParentHWnd: HWnd; const Caption: string; const Root: WideString;
out Directory: string): Boolean;
var
BrowseInfo: TBrowseInfo;
Buffer: PChar;
RootItemIDList, ItemIDList: PItemIDList;
ShellMalloc: IMalloc;
IDesktopFolder: IShellFolder;
Eaten, Flags: LongWord;
begin
Result := False;
Directory := '';
FillChar(BrowseInfo, SizeOf(BrowseInfo), 0);
if (ShGetMalloc(ShellMalloc) = S_OK) and (ShellMalloc <> nil) then
begin
Buffer := ShellMalloc.Alloc(MAX_PATH);
try
SHGetDesktopFolder(IDesktopFolder);
IDesktopFolder.ParseDisplayName(Application.Handle, nil,
POleStr(Root), Eaten, RootItemIDList, Flags);
with BrowseInfo do
begin
hwndOwner := ParentHWnd;
pidlRoot := RootItemIDList;
pszDisplayName := Buffer;
lpszTitle := PChar(Caption);
ulFlags := BIF_RETURNONLYFSDIRS;
end;
ItemIDList := ShBrowseForFolder(BrowseInfo);
Result := ItemIDList <> nil;
if Result then
begin
ShGetPathFromIDList(ItemIDList, Buffer);
ShellMalloc.Free(ItemIDList);
Directory := Buffer;
end;
finally
ShellMalloc.Free(Buffer);
end;
end;
end;
海天候 2002-01-26
  • 打赏
  • 举报
回复
shbroswerfolder...
ddl2 2002-01-26
  • 打赏
  • 举报
回复
同意楼上的!!!
ysmstoneman 2002-01-26
  • 打赏
  • 举报
回复
直接用opendialog组件,调用
if opendialog.Execute then
……
luo73 2002-01-26
  • 打赏
  • 举报
回复
很简单,下一个控件:
Site:
http://www.yaoba.com/~masterall/vcl/net/vcl_net.htm
Greenberet 2002-01-25
  • 打赏
  • 举报
回复
* Prompted
selectdirector ---- instead ------> SelectDirectory
Greenberet 2002-01-25
  • 打赏
  • 举报
回复
if use(copy_paste) then
MessageBox('Right! Check-out.', 'Information', MB_OK + MB_ICONINFORMATION);
afeisky 2002-01-25
  • 打赏
  • 举报
回复
Delphi有类似的控件啊,但对话框就要自己做了。
DURON800 2002-01-25
  • 打赏
  • 举报
回复
我用一个很笨的方法:
用opendialog控件,先选一个文件(此文件夹下的);
然后用extractfilepath(opendialog.filename)函数来获取这个文件夹;
copy_paste 2002-01-25
  • 打赏
  • 举报
回复

uses filectrl;

selectdirector

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧