This is the source code in Delphi to find the Path of desktop for the current user.
The path is stored to FBuf variable

Var
  Allocator: IMalloc;
  SpecialDir: PItemIdList;
  FBuf: array[0..MAX_PATH] of Char;




begin
      if SHGetMalloc(Allocator) = NOERROR then 
      begin
        SHGetSpecialFolderLocation(application.Handle, CSIDL_Desktop, SpecialDir);
        SHGetPathFromIDList(SpecialDir, @FBuf[0]);
        Allocator.Free(SpecialDir);
      end;
end;

Leave a Reply

Your email address will not be published. Required fields are marked *