Discuss this help topic in CBFS Forum

OnCanFileBeDeleted event/delegate/callback


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

CallbackFileSystem     See also    


This event is fired when the OS needs to query the possibility to delete the file or directory.


    property OnCanFileBeDeleted : TCbFsCanFileBeDeletedEvent;
    TCbFsCanFileBeDeletedEvent = procedure( Sender : TObject; FileInfo: TCbFsFileInfo; HandleInfo: TCbFsHandleInfo, var CanBeDeleted: Boolean ) of object;

[C++ (Lib)]
    void (__stdcall *CbFsCanFileBeDeletedEvent)(void* Sender, CbFsFileInfo* FileInfo, CbFsHandleInfo* HandleInfo, bool & CanBeDeleted );

[C++ (VCL)]
    typedef void (__closure *TCbFsCanFileBeDeletedEvent)( System::TObject* Sender, TCbFsFileInfo* FileInfo, TCbFsHandleInfo* HandleInfo, bool & CanBeDeleted );

[C++ (.NET)]
    public __delegate void CbFsCanFileBeDeletedEvent( CallbackFileSystem^ Sender, CbFsFileInfo^ FileInfo, CbFsHandleInfo^ HandleInfo, bool% CanBeDeleted );

    public void CbFsCanFileBeDeletedEvent( CallbackFileSystem Sender, CbFsFileInfo FileInfo, CbFsHandleInfo HandleInfo, ref bool CanBeDeleted );

    Sub CbFsCanFileBeDeletedEvent( ByVal Sender As CallbackFileSystem, ByVal FileInfo As CbFsFileInfo, ByVal HandleInfo As TCbFsHandleInfo, ByRef CanBeDeleted As Boolean )

    byte[] ICbFsFileEvents.onCanFileBeDeleted( CallbackFileSystem sender, CbFsFileInfo fileInfo, CbFsHandleInfo handleInfo, boolRef canBeDeleted );


  • Sender - reference to the class that called the delegate/event handler
  • FileInfo - contains information about the file
  • HandleInfo - contains information about particular opened file or directory handle
  • CanBeDeleted - the event handler must set this parameter to true if the file or directory can be deleted and to false otherwise.


This event is fired when the OS needs to check if the file or directory can be deleted. Firing of this event doesn't necessarily means, that the entry will be deleted even if CanBeDeleted was set to true.
Read more about contexts.

Error handling

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

See also


Discuss this help topic in CBFS Forum