This documentation is archived and is not being maintained.


Creates a registry key or modifies an existing registry key.

[ rdx( 
) ]


The name of the key to be created or opened.
valuename (optional)
Specifies the value field to be set. If a value field with this name does not already exist in the key, it is added.
The type of registry key being added. Can be one of the following: text, dword, binary, or CString.

Attribute Context

Applies to class or struct member
Repeatable No
Required attributes None
Invalid attributes None

For more information about the attribute contexts, see Attribute Contexts.


The rdx C++ attribute creates or modifies an existing registry key for a COM component. The attribute adds a BEGIN_RDX_MAP macro to the object that implements the target member. RegistryDataExchange, a function injected as a result of the BEGIN_RDX_MAP macro, can be used to transfer data between the registry and the data members

This attribute can be used in conjunction with the coclass, progid, or vi_progid attributes or other attributes that implies one of these.


The following code adds a registry key called MyValue to the system registry describing the CMyClass COM component.

// cpp_attr_ref_rdx.cpp
// compile with: /LD /link /OPT:NOREF
#include "atlbase.h"

[module (name="MyLib")];

class CMyClass
        lstrcpy(m_sz, "SomeValue");

    [ rdx(key = "HKCR\\MyApp.MyApp.1", valuename = "MyValue",
      regtype = "text")]
    char m_sz[256];

See Also

COM Attributes | registration_script | Attributes Samples