Форум: "WinAPI";
Текущий архив: 2004.08.29;
Скачать: [xml.tar.bz2];
ВнизOpenDir Найти похожие ветки
← →
Dir (2004-07-16 20:12) [0]Как можно вывести окно выбора директории?
← →
Dolt © (2004-07-16 22:15) [1]Function ExploreFolder(Title:String;Var Dir:String):Boolean;
var
Malloc: IMalloc;
Desktop: IShellFolder;
pidlMyComputer: PItemIDList;
pidlResult: PItemIDList;
pidlInitialFolder: PItemIDList;
bi: TBrowseInfo;
ProgramFilesDir: WideString;
CharsDone: ULONG;
dwAttributes: DWORD;
begin
result:=False;
if SUCCEEDED(SHGetMalloc(Malloc)) then
try // acquire shell namespace root folder
if SUCCEEDED( SHGetDesktopFolder( Desktop ) ) then
try // acquire folder that will serve as root in dialog
if SUCCEEDED( SHGetSpecialFolderLocation( 0, CSIDL_DRIVES, pidlMyComputer ) ) then
try // acquire PIDL for folder that will be selected by default
if
SUCCEEDED(
Desktop.ParseDisplayName( 0, nil, PWideChar(ProgramFilesDir), CharsDone,
pidlInitialFolder, dwAttributes ))
then
try
SetLength(Dir, MAX_PATH );
FillChar( bi, sizeof(bi), 0 );
bi.pidlRoot := pidlMyComputer; // roots from "My Computer"
bi.pszDisplayName := PChar(Dir);
bi.lpszTitle := PChar(Title);
bi.ulFlags := BIF_STATUSTEXT;
pidlResult := SHBrowseForFolder( bi );
if Assigned(pidlResult) then
try
SetLength(Dir, MAX_PATH );
result:=true;
SHGetPathFromIDList( pidlResult, PChar(Dir));
Dir:=String(PChar(Dir));
finally
Malloc.Free( pidlResult ); // release returned value
end;
finally
Malloc.Free( pidlInitialFolder ); // release PIDL for folder that
// was selected by default
end;
finally
Malloc.Free( pidlMyComputer ); // release folder that was served as root in dialog
end;
finally
Desktop := nil; // release shell namespace root folder
end;
finally
Malloc := nil; // release shell"s allocator
end;
end;
(c) Не мое - нашел в инете
← →
Dimaxx (2004-07-16 23:55) [2]SHBrowseForFolder из shellapi
← →
Dimaxx (2004-07-16 23:56) [3]Тьфу, нет его там. Вот декларация...
function SHBrowseForFolder(var lpbi: TBrowseInfo): PItemIDList; stdcall; external "shell32.dll" name "SHBrowseForFolderA";
TBrowseInfo = record
hwndOwner: HWND;
pidlRoot: PItemIDList;
pszDisplayName: PAnsiChar; { Return display name of item selected. }
lpszTitle: PAnsiChar; { text to go in the banner over the tree. }
ulFlags: UINT; { Flags that control the return stuff }
lpfn: Pointer; //TFNBFFCallBack;
lParam: LPARAM; { extra info that"s passed back in callbacks }
iImage: Integer; { output var: where to return the Image index. }
end;
← →
Григорьев Антон © (2004-07-17 08:16) [4]Функция SelectDirectiry из модуля FileCtrl
Страницы: 1 вся ветка
Форум: "WinAPI";
Текущий архив: 2004.08.29;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.034 c