OnCloseFile 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 close the file.


    property OnCloseFile : TCBCloseFileEvent;
    TCBCloseFileEvent = procedure( Sender : TObject; FileInfo: TCBFileInfo; HandleInfo: TCBHandleInfo ) of object;

[C++ (Lib)]
    void (__stdcall *CBCloseFileEvent)(void* Sender, CBFileInfo* FileInfo, CBHandleInfo* HandleInfo );

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

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

    public void CBCloseFileEvent( CBFSConnect Sender, CBFileInfo FileInfo, CBHandleInfo HandleInfo );

    Sub CBCloseFileEvent( ByVal Sender As CBFSConnect, ByVal FileInfo As CBFileInfo, ByVal HandleInfo As TCBHandleInfo )

    void ICbFsFileEvents.onCloseFile( CBFSConnect sender, CBFileInfo fileInfo, CBFileInfo FileInfo, CBHandleInfo HandleInfo );


  • Sender - reference to the class that called the delegate/event handler
  • FileInfo - contains information about the opened file
  • HandleInfo - contains information about particular opened file or directory handle


This event is fired when the OS needs to close the previously created or opened file. Use FileInfo and HandleInfo to identify the file that needs to be closed.
Read more about contexts.

Note, that if CallAllOpenCloseCallbacks property is set to false (default value), then this event is fired only after the last handle to the file is closed.

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

OnCleanupFile event     OnCreateFile event     OnOpenFile event     CallAllOpenCloseCallbacks property