uses shlobj;
procedure TForm1.Button1Click(Sender: TObject);
var PIDLItemIDList;
StartupDirectory:Array[0..MAX_PATH] of char;
begin
SHGetSpecialFolderLocation(0,CSIDL_DESKTOPDIRECTORY,PIDL);//获得桌面的Itemidlist
SHGetPathFromIDList(PIDL,StartupDirectory);//获得桌面路径
ShowMessage(StartupDirectory);
end;