| Scalabium Software | |
| Knowledge for your independence'. | |
|  Home  Delphi and C++Builder
        tips | 
| #106: How can I read a path of system folder? | 
| 
 | Just now in delphi-programming I posted a code which allows to recieve a path to some system folder (StartUp, Recent Files etc). As you know, the path can be different on other computers (depends from operationg system, localization, user profile and user settings). This code allows to read a current value: 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: 
 | 
 | 
|       | Copyright© 1998-2025, Scalabium
        Software. All rights reserved. |