Control over registry operations in Windows and .NET applications

OnCloseFileC event/delegate/callback


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

CallbackRegistry     See also    


This callback is called before the file or directory is closed.


    property OnCloseFileC : TCbFltCloseFileEventC;
    TCbFltCloseFileEventC = procedure(Sender : TObject; FileName: TCBString; var UserContext: pointer) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    typedef void (*CbFltCloseFileEventC)(CallbackRegistry* Sender, LPCWSTR FileName, PVOID *UserContext);

[C++ (VCL)]
    typedef void __fastcall (__closure *TCbFltCloseFileEventC)(System::TObject* Sender, TCBString FileName, void* &UserContext);

[C++ (.NET)]
    public delegate void CbFltCloseFileEventC(CallbackRegistry^ Sender, String^ FileName, IntPtr% UserContext);

    delegate void CbFltCloseFileEventC(CallbackRegistry Sender, string FileName, ref IntPtr UserContext);

    Delegate Sub CbFltCloseFileEventC(ByVal Sender As CallbackRegistry, ByVal FileName As String, ByRef UserContext As IntPtr)


  • Sender - reference to the class that called the delegate/event handler
  • FileName - contains the name of the file which is being closed
  • UserContext - the placeholder for the application-defined data


This callback is called before the file or directory with given name is closed.

The application can use UserContext to store the reference to some information, identifying the file or directory (such as file/directory handle or database record ID or reference to the stream class etc). The value, set in the event handler, is later passed to all operations, related to this file, together with file/directory name and attributes. Read more about contexts.

Error handling

See Error handling topic for detailed information about how to report errors, which occur in the event handlers, back to CallbackRegistry.

See also

OnCloseFileN     OnCreateFileC     OnOpenFileC    

Back to top