OnIsDirectoryEmpty event/delegate/callback


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

CBFSConnect     See also    


The event is fired when CBFS needs to check if the directory is empty.


    property OnIsDirectoryEmpty : TCBIsDirectoryEmptyEvent;
    TCBIsDirectoryEmptyEvent = procedure( Sender : TObject; DirectoryInfo: TCBFileInfo; FileName: TCBString; var IsEmpty: boolean ) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    void (__stdcall *CBIsDirectoryEmptyEvent)(void* Sender, CBFileInfo* DirectoryInfo, LPCWSTR FileName, LPBOOL IsEmpty );

[C++ (VCL)]
    typedef void (__closure *TCBIsDirectoryEmptyEvent)( System::TObject* Sender, TCBFileInfo* DirectoryInfo, TCBString FileName, bool & IsEmpty );

[C++ (.NET)]
    public __delegate void CBIsDirectoryEmptyEvent( CBFSConnect^ Sender, CBFileInfo^ DirectoryInfo, String^ FileName, bool% IsEmpty );

    public void CBIsDirectoryEmptyEvent( CBFSConnect Sender, CBFileInfo DirectoryInfo, String FileName, ref bool IsEmpty );

    Sub CBIsDirectoryEmptyEvent( ByVal Sender As CBFSConnect, ByVal DirectoryInfo As CBFileInfo, ByVal FileName As String, ByRef IsEmpty As Boolean )

    void ICbFsEnumerateEvents.onIsDirectoryEmpty( CBFSConnect sender, CBFileInfo directoryInfo, string fileName, boolRef isEmpty );


  • Sender - reference to the class that called the delegate/event handler.
  • DirectoryInfo - information about the directory which is being queried.
  • FileName - the name of the directory whose status is queried
  • IsEmpty - the event handler must place the file attributes to this parameter


This event is fired when the OS wants to delete the directory, and CBFS in turn needs to check whether the directory is empty or contains some files.

The event is fired, when the directory is opened. The handle and UserContext that DirectoryInfo contains 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. Throwing ECBFSConnectError exception from this event handler will not cause the OS to abort the operation or display an error message to the user.

See also