本人想实现一个功能,点击一个按钮后马上弹出来一个目录浏览的对话框,可以选择一个路径,(比如点击browse按钮,选择c:\program files目录)好像有一个函数,但是想不起来了,呵呵。
解决方案 »
- delphi中有没有类似网页中hidden控件那样的组件,外观不可见用来存储一些字符串值,但是又不占用窗体的位置
- 有没有人用过DXSocket控件。怎么连接和发送数据啊。
- dll函数调用问题!有代码...
- 两个SQL哪个快
- 如何得到excel工资表的名称?很关键的一个难题
- MDI窗口中如何控制只能打开一个窗口啊!
- 我的ID字段在数据库中是自动增加的,为什么当我在TTABLE中更新数据时,会出错,有什么解决办法?
- 串口通讯时:把MSComm1.Output:=Buf;出错?
- win2000下写的程序到98下字体为什么会变?
- 奇怪在MDI的CHILD窗口上,当我按‘X’关闭窗口时,它却最小化。‘X’失灵了
- 为什么DBGridEh的列复选框不能编辑?
- 各位大哥帮帮小弟吧,我想在程序中获得另一个程序的窗口中的richedit中的text内容,现在我知道了这个窗口的句柄,要怎样才能得到那个rich
SelectDirectory()
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;
//slFolder :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);
//SHGetDesktopFolder( slFolder ); 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;