ShellBrowser Delphi Components Documentation

Renames the file system object represented by this instance.

procedure Rename(pNewName: string; pWindowHandle: THandle = 0; const pUpdatePidl: Boolean = true);
pNewName: string 
The new name for the element. No path, only a name. For files, names should include the file-extension. 
pWindowHandle: THandle = 0 
A handle that is used to display information to the user (e.g. a confirmation dialog). 
const pUpdatePidl: Boolean = true 
True (default), if this instance should be updated to the new, renamed value; false if it should be left untouched. 


If pWindowHandle is 0, a silent rename without dialogs is executed. Problems that might occur (i.e. a file of the same name already exists) cause exceptions.  

Rename operations for long paths (exceeding 260 chars) are handled silently, too.  

Not updating the current instance with the renamed value can be necessary in use cases, where different references to the same ItemIdList need to be updated. In these cases, where e.g. UI updates are usually triggered by handling respective shell notifications, a problem might arise, if the underlying ItemIdList is already updated.  


Raised, if the element is not renameable or if renaming failed.