Ich habe mal eben D5 angeworfen:
Delphi-Quellcode:
program Demo;
{$APPTYPE CONSOLE}
uses
Windows,
SysUtils,
ActiveX,
ShlObj;
function IncludeTrailingPathDelimiter(path:
String):
String;
begin
Result := IncludeTrailingBackslash(path);
end;
function GetSpecialFolderLocation(csidl: integer):
string;
var
pMalloc: IMalloc;
pidl: PItemIDList;
path:
array [0..MAX_PATH]
of Char;
begin
Result := '
?';
if SHGetMalloc(pMalloc) = S_OK
then
begin
SHGetSpecialFolderLocation(0, csidl, pidl);
SHGetPathFromIDList(pidl, path);
Result := IncludeTrailingPathDelimiter(Path);
pMalloc.Free(pidl);
end;
end;
begin
WriteLn(GetSpecialFolderLocation($23));
end.
Das Herzstück ist der
API-Call SHGetSpecialFolderLocation() und zu dem sagt der Windows Platform
SDK:
Code:
Minimum
DLL Version shell32.dll version 4.7 or later
Custom Implementation No
Header shlobj.h
Import library shell32.lib
Minimum operating systems Windows NT 4.0, Windows 95
marabu