OnRenameOrMoveFile event/delegate/callback


Pascal    C++ (Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET    Java 

CBFSConnect     See also    


This event is fired when the OS needs to rename or move the file within a file system.


    property OnRenameOrMoveFile : TCBRenameOrMoveFileEvent;
    TCBRenameOrMoveFileEvent = procedure( Sender : TObject; FileInfo: TCBFileInfo; NewFileName: TCBString ) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    void (__stdcall *CBRenameOrMoveFileEvent)(void* Sender, CBFileInfo* FileInfo, wchar_t* NewFileName );

[C++ (VCL)]
    typedef void (__closure *TCBRenameOrMoveFileEvent)( System::TObject* Sender, TCBFileInfo* FileInfo, TCBString NewFileName );

[C++ (.NET)]
    public __delegate void CBRenameOrMoveFileEvent( CBFSConnect^ Sender, CBFileInfo^ FileInfo, String^ NewFileName );

    public void CBRenameOrMoveFileEvent( CBFSConnect Sender, CBFileInfo FileInfo, String NewFileName );

    Sub CBRenameOrMoveFileEvent( ByVal Sender As CBFSConnect, ByVal FileInfo As CBFileInfo, ByVal NewFileName As String )

    ICbFsFileEvents.onRenameOrMoveFile( CBFSConnect sender, CBFileInfo fileInfo, String newFileName );


  • Sender - reference to the class that called the delegate/event handler
  • FileInfo - contains the information about the file
  • NewFileName - new fully qualified name for the file.


This event is fired when the OS needs to rename or move the file within a file system.

Windows API functions (MoveFile and MoveFileEx) let the calling process specify what to do if the destination already exist. The process may request the destination file to be overriden or the operation can be cancelled. CBFS driver handles this parameter internally (as it knows whether the destination exists). This event is fired only when the operation must be performed, i.e. the destination file either doesn't exist or the calling process requested the destination to be overriden. If the event handler doesn't "want" to override the file, it can throw the exception with the appropriate error code.

Error handling

See Error handling topic for detailed information about how to report errors, which occur in the event handlers, back to CBFS Connect.

See also