uses ShlObj, ActiveX;<br><br>function GetSystemPath(Folder: Integer): string;<br>var<br> PIDL: PItemIDList;<br> Path: LPSTR;<br> AMalloc: IMalloc;<br>begin<br> Path := StrAlloc(MAX_PATH);<br> SHGetSpecialFolderLocation(Application.Handle, Folder, PIDL);<br> if SHGetPathFromIDList(PIDL, Path) then<br> Result := Path;<br> SHGetMalloc(AMalloc);<br> AMalloc.Free(PIDL);<br> StrDispose(Path);<br>end;<br> <br>你可以使用不同的参数调用这个函数,例如:<br><br>CSIDL_DESKTOP --- WINDOWS/Desktop<br>CSIDL_DESKTOPDIRECTORY --- WINDOWS/Desktop<br>CSIDL_FONTS --- WINDOWS/FONTS<br>CSIDL_NETHOOD --- WINDOWS/NetHood<br>CSIDL_PERSONAL --- X:/My Documents<br>CSIDL_PROGRAMS --- WINDOWS/StartMenu/Programs<br>CSIDL_RECENT --- WINDOWS/Recent<br>CSIDL_SENDTO --- WINDOWS/SendTo<br>CSIDL_STARTMENU --- WINDOWS/Start Menu<br>CSIDL_STARTUP --- WINDOWS/Start Menu/Programs/StartUp<br>CSIDL_TEMPLATES --- WINDOWS/ShellNew<br>