OnCloseKeyHandle event/delegate/callback


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

CBFSRegistry     See also    


This callback is called when an application-provided key handle should be closed.


    property OnCloseKeyHandle : TCbRegCloseKeyHandleEvent;
    TCbRegCloseKeyHandleEvent = procedure( Sender : TObject; UserContext: pointer; KeyHandle: THandle; KeyHandleContext: pointer; Error: LongWord ) of object;

[C++ (Lib)]
    typedef void (*CbRegCloseKeyHandleEvent)( CBFSRegistry* Sender, LPVOID UserContext, HANDLE KeyHandle, PVOID KeyHandleContext, DWORD Error );

[C++ (VCL)]
    typedef void __fastcall (__closure *TCbRegCloseKeyHandleEvent)( System::TObject* Sender, void * UserContext, unsigned KeyHandle, void * KeyHandleContext, unsigned Error );

[C++ (.NET)]
    public delegate void CbRegCloseKeyHandleEvent( CBFSRegistry^ Sender, Object^ UserContext, SafeHandle^ KeyHandle, Object^ KeyHandleContext, UInt32 Error );

    delegate void CbRegCloseKeyHandleEvent( CBFSRegistry Sender, Object UserContext, SafeHandle KeyHandle, Object KeyHandleContext, UInt32 Error );

    Delegate Sub CbRegCloseKeyHandleEvent( ByVal Sender As CBFSRegistry, ByVal UserContext As Object, ByVal KeyHandle As SafeHandle, ByVal KeyHandleContext As Object, ByVal Error As UInt32 )


  • Sender - reference to the class that called the delegate/event handler
  • UserContext - the placeholder for the application-defined data
  • KeyHandle - handle of the key to be closed
  • KeyHandleContext - the placeholder for the application-defined data set in On*CreateKey or On*OpenKey together with the key handle
  • Error - contains the error code if the error happened during the use of the application-provided key


The callback/event is used to ask the application to close an application-provided handle passed from the CbRegPreCreateKeyEvent or CbRegPreOpenKeyEvent callbacks.
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 CBFSRegistry.

See also

OnPreCreateKey     OnPreOpenKey