Probiers mal mit folgender Funktion:
Delphi-Quellcode:
function GetFolder: string;
var
bi: TBROWSEINFO;
lpBuffer: PChar;
pidlPrograms,
pidlBrowse: PItemIDList;
ShellH: IMalloc;
begin
if (not SUCCEEDED(SHGetSpecialFolderLocation(0, 0,
pidlPrograms))) then
Exit;
try
GetMem(lpBuffer, MAX_PATH);
try
bi.hwndOwner:=GetActiveWindow;
bi.pidlRoot:=pidlPrograms;
bi.pszDisplayName:=lpBuffer;
bi.lpszTitle:='Zielverzeichnis wählen';
bi.ulFlags:=BIF_RETURNONLYFSDIRS;
bi.lpfn:=NIL;
bi.lParam:=0;
pidlBrowse:=SHBrowseForFolder(bi);
if (pidlBrowse <> nil) and (SHGetPathFromIDList(pidlBrowse,
lpBuffer)) then
Result:=lpBuffer;
finally
FreeMem(lpBuffer);
end;
finally
if SHGetMalloc(ShellH) = NOERROR then
ShellH.Free(pidlBrowse);
end;
end;