Skip to content

Latest commit

 

History

History
90 lines (75 loc) · 2.3 KB

File metadata and controls

90 lines (75 loc) · 2.3 KB
title requires_category | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-windows
ms.tgt_pltfrm
ms.topic language-reference
f1_keywords
vc-attr.requires_category
dev_langs
C++
helpviewer_keywords
requires_category attribute
ms.assetid a645fdc6-1ef5-414d-8c56-5fe2686d4687
caps.latest.revision 10
author mikeblome
ms.author mblome
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

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

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

COM Attributes
implements_category