Registriert seit: 23. Mär 2003
Ort: Münster
3.750 Beiträge
Delphi 2010 Professional
|
Re: Problem mit "ChooseFolder"
2. Jan 2004, 13:30
Ich verwende den:
Delphi-Quellcode:
uses
ShlObj;
function OpenFolder(root: Integer; Caption: string): string;
var
bi: TBrowseInfo;
lpBuffer: PChar;
pidlPrograms, pidlBrowse: PItemIDList;
begin
if (not SUCCEEDED(SHGetSpecialFolderLocation(GetActiveWindow, root,
pidlPrograms))) then
exit;
lpBuffer := StrAlloc(MAX_PATH);
bi.hwndOwner := GetActiveWindow;
bi.pidlRoot := pidlPrograms;
bi.pszDisplayName := lpBuffer;
bi.lpszTitle := PChar(Caption);
bi.ulFlags := BIF_RETURNONLYFSDIRS;
bi.lpfn := nil;
bi.lParam := 0;
pidlBrowse := SHBrowseForFolder(bi);
if (pidlBrowse <> nil) then
if SHGetPathFromIDList(pidlBrowse, lpBuffer) then
Result := lpBuffer;
StrDispose(lpBuffer);
end;
///////////////////////////////////
// Aufruf
var
s: string;
begin
s := OpenFolder(CSIDL_DRIVES, 'Verzeichnis öffnen');
if s <> '' then
// ...
end;
mfG
mirage228
David F.
|
|
Zitat
|