Discuss this help topic in CBFS Forum

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


    property OnCloseFile : TCbFsCloseFileEvent;
    TCbFsCloseFileEvent = procedure( Sender : TObject; FileInfo: TCbFsFileInfo; HandleInfo: TCbFsHandleInfo ) of object;

[C++ (Lib)]
    void (__stdcall *CbFsCloseFileEvent)(void* Sender, CbFsFileInfo* FileInfo, CbFsHandleInfo* HandleInfo );

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

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

    public void CbFsCloseFileEvent( CallbackFileSystem Sender, CbFsFileInfo FileInfo, CbFsHandleInfo HandleInfo );

    Sub CbFsCloseFileEvent( ByVal Sender As CallbackFileSystem, ByVal FileInfo As CbFsFileInfo, ByVal HandleInfo As TCbFsHandleInfo )

    void ICbFsFileEvents.onCloseFile( CallbackFileSystem sender, CbFsFileInfo fileInfo, CbFsFileInfo FileInfo, CbFsHandleInfo 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 Callback File System. Throwing ECBFSError 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    

Discuss this help topic in CBFS Forum