试了一下,下面的也行,也要引用 shlobj :
function GetDesktopFolder: string;
var
Buffer: PChar;
begin
Result := '';
GetMem(Buffer, MAX_PATH);
try
if ShGetSpecialFolderPath(Application.Handle,Buffer, CSIDL_DESKTOP, False) then
SetString(Result, Buffer, StrLen(Buffer));
finally
FreeMem(Buffer)
end;
end;