This event is fired when the OS needs to cleanup the file.
property OnCleanupFile : TCBCleanupFileEvent;
TCBCleanupFileEvent = procedure(
Sender : TObject;
) of object;
void (__stdcall *CBCleanupFileEvent)(void* Sender,
typedef void (__closure *TCBCleanupFileEvent)(
public __delegate void CBCleanupFileEvent(
public void CBCleanupFileEvent(
ByVal Sender As CBFSConnect,
ByVal FileInfo As CBFileInfo,
ByVal HandleInfo As TCBHandleInfo
- 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 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.
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.