OnCanFileBeDeleted event/delegate/callback

Filter:

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

CBFSConnect     See also    

Overview

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

Declaration

[Pascal]
    property OnCanFileBeDeleted : TCBCanFileBeDeletedEvent;
    TCBCanFileBeDeletedEvent = procedure( Sender : TObject; FileInfo: TCBFileInfo; HandleInfo: TCBHandleInfo; var CanBeDeleted: Boolean ) of object;

[C++ (Lib)]
    void (__stdcall *CBCanFileBeDeletedEvent)(void* Sender, CBFileInfo* FileInfo, CBHandleInfo* HandleInfo, bool & CanBeDeleted );

[C++ (VCL)]
    typedef void (__closure *TCBCanFileBeDeletedEvent)( System::TObject* Sender, TCBFileInfo* FileInfo, TCBHandleInfo* HandleInfo, bool & CanBeDeleted );

[C++ (.NET)]
    public __delegate void CBCanFileBeDeletedEvent( CBFSConnect^ Sender, CBFileInfo^ FileInfo, CBHandleInfo^ HandleInfo, bool% CanBeDeleted );

[C#]
    public void CBCanFileBeDeletedEvent( CBFSConnect Sender, CBFileInfo FileInfo, CBHandleInfo HandleInfo, ref bool CanBeDeleted );

[VB.NET]
    Sub CBCanFileBeDeletedEvent( ByVal Sender As CBFSConnect, ByVal FileInfo As CBFileInfo, ByVal HandleInfo As TCBHandleInfo, ByRef CanBeDeleted As Boolean )

[Java]
    byte[] ICbFsFileEvents.onCanFileBeDeleted( CBFSConnect sender, CBFileInfo fileInfo, CBHandleInfo handleInfo, boolRef canBeDeleted );

Parameters

  • 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.

Description

This event is fired when the OS sets DELETE_ON_CLOSE flag for the opened file, and CBFS 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.

The event is fired, when the file is opened. The handle and UserContext that FileInfo and HandleInfo contain are valid.

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

OnDeleteFile