OnCleanupFile 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 cleanup the file.

Declaration

[Pascal]
    property OnCleanupFile : TCBCleanupFileEvent;
    TCBCleanupFileEvent = procedure( Sender : TObject; FileInfo: TCBFileInfo; HandleInfo: TCBHandleInfo ) of object;

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

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

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

[C#]
    public void CBCleanupFileEvent( CBFSConnect Sender, CBFileInfo FileInfo, CBHandleInfo HandleInfo );

[VB.NET]
    Sub CBCleanupFileEvent( ByVal Sender As CBFSConnect, ByVal FileInfo As CBFileInfo, ByVal HandleInfo As TCBHandleInfo )

[Java]
    void ICbFsFileEvents.onCleanupFile( CBFSConnect sender, CBFileInfo fileInfo, CBFileInfo FileInfo, CBHandleInfo HandleInfo );

Parameters

  • 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

Description

This event is fired when the OS needs to close the handle to the previously created or opened file. Both OnCleanupFile and OnCloseFile are fired for every opened handle. This event is different from OnCloseFile in that OnCleanupFile happens immediately when the handle to the file is closed by the application, while OnCloseFile can be called much later when the OS itself decides that the file can be closed. There can be other operations such as OnReadFile and OnWriteFile performed by the system components (memory manager, cache manager) before the handle is finally closed.
Read more about contexts.

Use FileInfo and HandleInfo to identify the file that needs to be closed.

OnCleanupFile is optional event, i.e. you are not required to handle it.

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

OnCloseFile     OnCreateFile     OnOpenFile