Control registry operations in Windows and .NET applications

OnPreQueryValueKey event/delegate/callback


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

CallbackRegistry     See also    


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


    property OnPreQueryValueKey : TCbRegPreQueryValueKeyEvent;
    TCbRegPreQueryValueKeyEvent = procedure( Sender : TObject; UserContext: pointer; ValueName: TCBString; KeyValueInformationClass: KEY_VALUE_INFORMATION_CLASS; KeyValueInformation: TCbRegInformation; var CallPostCallback : boolean; var StopFiltering : boolean ) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    typedef void (*CbRegPreQueryValueKeyEvent)( CallbackRegistry* Sender, LPVOID UserContext, PCWSTR ValueName, KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, CbRegInformation *KeyValueInformation, BOOL * CallPostCallback, BOOL * StopFiltering );

[C++ (VCL)]
    typedef void __fastcall (__closure *TCbRegPreQueryValueKeyEvent)( System::TObject* Sender, void *UserContext, TCBString ValueName, Cbregapi::_KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, TCbRegInformation *KeyValueInformation, bool &CallPostCallback, bool &StopFiltering );
    #ifdef UNICODE
    typedef UnicodeString TCBString;
    typedef WideString TCBString;

[C++ (.NET)]
    public delegate void CbRegPreQueryValueKeyEvent( CallbackRegistry^ Sender, Object^ UserContext, String^ ValueName, CbReg::KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, CbRegInformation^ KeyValueInformation, bool %CallPostCallback, bool %StopFiltering );

    delegate void CbRegPreQueryValueKeyEvent( CallbackRegistry Sender, Object UserContext, String ValueName, CbReg.KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, CbRegInformation KeyValueInformation, ref bool CallPostCallback, ref bool StopFiltering );

    Delegate Sub CbRegPreQueryValueKeyEvent( ByVal Sender As CallbackRegistry, ByVal UserContext As Object, ByVal ValueName As String, ByVal KeyValueInformationClass As CbReg.KEY_VALUE_INFORMATION_CLASS, ByVal KeyValueInformation As CbRegInformation, 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
  • ValueName - the name of the value being queried
  • KeyValueInformationClass - the value that indicates the type of information to be returned by the system in the KeyValueInformation object
  • KeyValueInformation - the object that contains information being returned to the system
  • 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 - if StopFiltering is set to true, no other callbacks for the created key handle will be called

Values of KeyValueInformationClass


This callback/event is called before the request for key value data is processed by the registry manager in Windows. The name of the key should be obtained from the user context which must have been set in OnPreOpenKey/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

OnPostEnumerateValueKey     OnPreCreateKey     OnPreOpenKey    

Back to top