共用方式為


implements_category

Specifies the component categories implemented by the target class.

[ implements_category(
   implements_category="uuid"
) ]

Parameters

  • implements_category
    The ID of the implemented category.

Remarks

The implements_category C++ attribute specifies the component categories implemented by the target class. This is done by creating a CATEGORY map and adding separate entries specified by the implements_category attribute. For more information, see What are Component Categories and How Do They Work?.

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. If any single attribute is used, the other two are automatically applied. For example, if progid is applied, vi_progid and coclass are also applied.

Example

The following code specifies that the following object implements the Control category.

// cpp_attr_ref_implements_category.cpp
// compile with: /LD
#define _ATL_ATTRIBUTES
#include "atlbase.h"
#include "atlcom.h"

[module (name="MyLib")];
[ coclass, implements_category("CATID_Control"),
  uuid("20a0d0cc-5172-40f5-99ae-5e032f3205ae")]
class CMyClass {};

Requirements

Attribute Context

Applies to

class, struct

Repeatable

Yes

Required attributes

One of the following: coclass, progid, or vi_progid

Invalid attributes

None

For more information, see Attribute Contexts.

See Also

Reference

IMPLEMENTED_CATEGORY

Other Resources

COM Attributes

Class Attributes

Attributes Samples