System Delphi

Title: Retrieve Desktop directory
Question: How to get the current user Desktop Directory or other special directories ?
Answer:
Very simple function but hard to find the correct parameters:
uses ShlObj;
function GetDesktopDirectory: String;
var
PIDL : PItemIDList;
InFolder : array[0..MAX_PATH] of Char;
begin
SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, PIDL);
SHGetPathFromIDList(PIDL, InFolder);
Result := InFolder;
end;
Changing the parameter, you can access other Special Folders like
CSIDL_FAVORITES - Explorer Favorites
CSIDL_PROGRAMS - Program Files
CSIDL_APPDATA - Application Data
CSIDL_INTERNET_CACHE
CSIDL_COOKIES
CSIDL_HISTORY
Common Directories - Base Directory on a Multi Profile System
CSIDL_COMMON_STARTMENU -
CSIDL_COMMON_PROGRAMS
CSIDL_COMMON_STARTUP
CSIDL_COMMON_DESKTOPDIRECTORY
CSIDL_COMMON_FAVORITES
Health and Freedom,
Josir