Control registry operations in Windows and .NET applications

OnPreDeleteKey event/delegate/callback


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

CallbackRegistry     See also    


This callback is called before key deletion request is processed by the system code which deals with the registry.


    property OnPreDeleteKey : TCbRegPreDeleteKeyEvent;
    TCbRegPreDeleteKeyEvent = procedure( Sender : TObject; UserContext: pointer; var Processed: boolean; var CallPostCallback: boolean; var StopFiltering : boolean ) of object;

[C++ (Lib)]
    typedef void (*CbRegPreDeleteKeyEvent)( CallbackRegistry* Sender, LPVOID UserContext, BOOL * Processed, BOOL * CallPostCallback, BOOL * StopFiltering );

[C++ (VCL)]
    typedef void __fastcall (__closure *TCbRegPreDeleteKeyEvent)( System::TObject* Sender, void *UserContext, bool &Processed, bool &CallPostCallback, bool &StopFiltering );

[C++ (.NET)]
    public delegate void CbRegPreDeleteKeyEvent( CallbackRegistry^ Sender, Object^ UserContext, bool %Processed, bool %CallPostCallback, bool %StopFiltering );

    delegate void CbRegPreDeleteKeyEvent( CallbackRegistry Sender, Object UserContext, ref bool Processed, ref bool CallPostCallback, ref bool StopFiltering );

    Delegate Sub CbRegPreDeleteKeyEvent( ByVal Sender As CallbackRegistry, ByVal UserContext As Object, ByRef Processed As Boolean, ByRef CallPostCallback As Boolean, ByRef StopFiltering As Boolean )


  • Sender - reference to the class that called the delegate/event handler
  • UserContext - the placeholder for the application-defined data
  • Processed - can be specified that the callback completely processed the request. It matters only if "success" is returned. If this parameter is set then the post-processing callback will not be called. By default it's set to FALSE.
  • CallPostCallback - if it's set then the post-processing callback will be called. By default it's TRUE. This parameter doesn't matter when StopFiltering or Processed is set or non-successful result is returned.
  • StopFiltering - setting it to TRUE stops calling any other callbacks for this key handle. By default it's set to FALSE. Stop filtering can be returned not depending whether error is returned or not.


This callback/event is called before the application's request to delete a key is passed to the registry manager in Windows. The key is opened before any operation with it, i.e. you can expect one of OnPreCreateKey or OnPreOpenKey callback/event handler to be called before the call to OnPreDeleteKey. The name of the key should be obtained from the user context which must have been set in OnPreCreateKey/OnPreOpenKey callback/event handlers.
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

OnPostDeleteKey     OnPreCreateKey    

Back to top