Control registry operations in Windows and .NET applications

OnPreRenameKey event/delegate/callback


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

CallbackRegistry     See also    


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


    property OnPreRenameKey : TCbRegPreRenameKeyEvent;
    TCbRegPreRenameKeyEvent = procedure( Sender : TObject; UserContext: pointer; NewName : TCBString; var Processed: boolean; var CallPostCallback: boolean; var StopFiltering : boolean ) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

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

[C++ (VCL)]
    typedef void __fastcall (__closure *TCbRegPreRenameKeyEvent)( System::TObject* Sender, void *UserContext, TCBString NewName, bool &Processed, bool &CallPostCallback, bool &StopFiltering );
    #ifdef UNICODE
    typedef UnicodeString TCBString;
    typedef WideString TCBString;

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

    delegate void CbRegPreRenameKeyEvent( CallbackRegistry Sender, Object UserContext, string NewName, ref bool Processed, ref bool CallPostCallback, ref bool StopFiltering );

    Delegate Sub CbRegPreRenameKeyEvent( ByVal Sender As CallbackRegistry, ByVal UserContext As Object, ByVal NewName As String, 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
  • NewName - the new name of the key which is renamed
  • 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 rename a key is passed to the registry manager in Windows. The existing name of the key should be obtained from the user context which must have been set in OnPreCreateKey/OnPreOpenKey callback/event handlers.

You can pass the new name to OnPostRenameKey by storing NewName in the UserContext object.
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


Back to top