function getdesktopdir: string; var r: tregistry; begin r := tregistry.create; r.openkey('software\microsoft\windows\currentversion\explorer\shell folders', false); result := r.readstring('desktop'); result := uppercase(result);//辒搎為大小寫,可以不使用; r.free; end; //函數返回的字符串就是路徑;