SHGetSpecialFolderLocation




uses shlobj;

function GetDesktopFolder(): string;
var
  pItem: PItemIDList;
  temp: array[ 0 ..MAX_PATH] of Char;
begin
  SHGetSpecialFolderLocation( 0, CSIDL_DESKTOP, pItem); //CSIDL_DESKTOP:桌面;
  FillChar(temp, MAX_PATH, # 0);
  SHGetPathFromIDList(pItem, PChar(@temp));
  Result :=PChar(@temp);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Caption :=getDesktopFOlder;
end;




你可能感兴趣的:(location)