如果你是想改文件名的话,试试我这个<br>把c:/hubdog.txt 改成c:/newhubdog.txt<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> P: PWideChar;<br> NewPIDL,RenPIDL,PathPIDL: PItemIDList;<br> Flags,<br> NumChars: LongWord;<br> //Index: Integer;<br> NewShellFolder: IShellFolder;<br> Value,PathValue:String;<br>begin<br> SHGetDesktopFolder(FIDesktopFolder);<br> Value:='hubdog.txt';<br> PathValue:='C:/';<br> NumChars := Length(PathValue);<br> Flags := 0;<br> P := StringToOleStr(PathValue);<br><br> OLECheck(<br> FIDesktopFolder.ParseDisplayName(<br> Application.Handle,<br> nil,<br> P,<br> NumChars,<br> PathPIDL,<br> Flags)<br>  
;<br><br> OLECheck(<br> FIDesktopFolder.BindToObject(<br> PathPIDL,<br> nil,<br> IID_IShellFolder,<br> Pointer(NewShellFolder))<br>  
;<br><br> NumChars := Length(Value);<br> Flags := 0;<br> P := StringToOleStr(Value);<br><br> OLECheck(<br> NewShellFolder.ParseDisplayName(<br> Application.Handle,<br> nil,<br> P,<br> NumChars,<br> NewPIDL,<br> Flags)<br>  
;<br><br> if NewShellFolder.SetNameOf(<br> Application.Handle,<br> NewPIDL,<br> StringToOleStr('newhubdog.txt'),<br> 128,<br> RenPIDL<br> )=noerror then<br> showmessage('ok');<br> //SHChangeNotify(SHCNE_RENAMEITEM,SHCNF_FLUSH,NewPIDL,nil);<br>end;