Jeg poster det lige her
uses ShlObj, ActiveX;
function GetSystemPath(Folder: Integer): string;
var
PIDL: PItemIDList;
Path: LPSTR;
AMalloc: IMalloc;
begin
Path := StrAlloc(MAX_PATH);
SHGetSpecialFolderLocation(Application.Handle, Folder, PIDL);
if SHGetPathFromIDList(PIDL, Path) then
Result := Path;
SHGetMalloc(AMalloc);
AMalloc.Free(PIDL);
StrDispose(Path);
end;
Now you can call this function with different parameters. For example:
CSIDL_DESKTOP for WINDOWS\\Desktop
CSIDL_DESKTOPDIRECTORY for WINDOWS\\Desktop
CSIDL_FONTS for WINDOWS\\FONTS
CSIDL_NETHOOD for WINDOWS\\NetHood
CSIDL_PERSONAL for X:\\My Documents
CSIDL_PROGRAMS for WINDOWS\\StartMenu\\Programs
CSIDL_RECENT for WINDOWS\\Recent
CSIDL_SENDTO for WINDOWS\\SendTo
CSIDL_STARTMENU for WINDOWS\\Start Menu
CSIDL_STARTUP for WINDOWS\\Start Menu\\Programs\\StartUp
CSIDL_TEMPLATES for WINDOWS\\ShellNew
GetSystemPath(CSIDL_STARTUP);
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GED d- s: a--- C++ U? P L+ E? W++ N? o? K- w
O? M? V? PS PE? Y? PGP++ t 5? X+ R tv+ b+ DI? D+
G e-- h! !r y--
------END GEEK CODE BLOCK------