How to get the path to a folder from a GUID of a known folder in Delphi

I have one KNOWNFOLDERID, and I would like to know the corresponding path, for example C: .... \ folder.

KNOWNFOLDERIDcan be found here. http://msdn.microsoft.com/en-us/library/bb762584%28VS.85%29.aspx

I like to use win api (I don't want to build an array with all KNOWNFOLDERID and paths).

thank

+6
source share
2 answers

Just call the SHGetKnownFolderPathAPI function .

Since this feature was added in Vista, it will not be declared in the library modules shipped with Delphi 7. Therefore, you will need to declare it yourself.

type
  KNOWNFOLDERID = TGuid;

function SHGetKnownFolderPath(
  const rfid: KNOWNFOLDERID;
  dwFlags: DWORD; 
  hToken: THandle; 
  out ppszPath: PWideChar
): HResult; stdcall; external 'Shell32.dll';

, ​​ Vista, XP . , CSIDL, API- Vista.

+5

, , . , , . , , , .

:

SHGetKnownFolderPath - Win API, . , char, , CoTaskMemFree.

COM-, IKNOWNFOLDER.

0

All Articles