首页  编辑  

取的用户特殊目录

Tags: /超级猛料/Stream.File.流、文件和目录/目录/   Date Created:

uses shlobj, activeX;

ShGetSpecialFolderLocation

procedure FreePidl(pidl: PItemIDList);

begin

 CoTaskMemFree(pidl);

end;

procedure TForm1.Button1Click(Sender: TObject);

Var

 pidl: PItemIDList;

 buf: Array[0..MAX_PATH] of Char;

begin

 If Succeeded( ShGetSpecialFolderLocation( Handle, CSIDL_PERSONAL, pidl ))

 Then Begin

   If ShGetPathfromIDList( pidl, buf ) Then

     ShowMessage( buf );

   FreePIDL( pidl );

 End;

end;