requires_category
Specifies the required component categories of the target class.
Syntax
[ requires_category(
requires_category) ]
Parameters
requires_category
The ID of the required category.
Remarks
The requires_category C++ attribute specifies the component categories required by the target class. For more information, see REQUIRED_CATEGORY.
This attribute requires that the coclass, progid, or vi_progid attribute (or another attribute that implies one of these) also be applied to the same element.
Example
The following code requires that the object implement the Control category.
// cpp_attr_ref_requires_category.cpp
// compile with: /LD
#define _ATL_ATTRIBUTES
#include "atlbase.h"
#include "atlcom.h"
[module (name="MyLibrary")];
[ coclass, requires_category("CATID_Control"),
uuid("1e1a2436-f3ea-4ff3-80bf-5409370e8144")]
class CMyClass {};
Requirements
Attribute context | Value |
---|---|
Applies to | class , struct |
Repeatable | No |
Required attributes | One or more of the following: coclass , progid , or vi_progid . |
Invalid attributes | None |
For more information about the attribute contexts, see Attribute Contexts.
See also
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho