Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Creates a registry key or modifies an existing registry key.
Syntax
[ rdx(key, valuename=NULL, regtype) ]
Parameters
key
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.
regtype
The type of registry key being added. Can be one of the following: text, dword, binary, or CString.
Remarks
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.
Requirements
| Attribute context | Value |
|---|---|
| Applies to | class or struct member |
| Repeatable | No |
| Required attributes | None |
| Invalid attributes | None |
For more information about the attribute contexts, see Attribute Contexts.
Example
The following code adds a registry key called MyValue to the system describing the CMyClass COM component.
// cpp_attr_ref_rdx.cpp
// compile with: /LD /link /OPT:NOREF
#define _ATL_ATTRIBUTES
#include "atlbase.h"
[module (name="MyLib")];
class CMyClass {
public:
CMyClass() {
strcpy_s(m_sz, "SomeValue");
}
[ rdx(key = "HKCR\\MyApp.MyApp.1", valuename = "MyValue", regtype = "text")]
char m_sz[256];
};