次の方法で共有


IVsObjectList2.GetCategoryField2(UInt32, Int32, UInt32) Method

Definition

Returns the value for the specified category for the given list item.

public:
 int GetCategoryField2(System::UInt32 index, int Category, [Runtime::InteropServices::Out] System::UInt32 % pfCatField);
int GetCategoryField2(unsigned int index, int Category, [Runtime::InteropServices::Out] unsigned int & pfCatField);
public int GetCategoryField2 (uint index, int Category, out uint pfCatField);
abstract member GetCategoryField2 : uint32 * int * uint32 -> int
Public Function GetCategoryField2 (index As UInteger, Category As Integer, ByRef pfCatField As UInteger) As Integer

Parameters

index
UInt32

[in] Specifies the index of the list item of interest.

Category
Int32

[in] Specifies the category of interest. Values are taken from the LIB_CATEGORY enumeration.

pfCatField
UInt32

[out] Pointer to a variable holding the value returned.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell80.idl:

[C++]

HRESULT IVsObjectList2::GetCategoryField2(  
   [in] ULONG Index,   
   [in] LIB_CATEGORY2 Category,   
   out,retval] DWORD *pfCatField  
);  

The environment's object manager calls this method to retrieve the category data for the list items. You must return in the pField parameter an enumerator value from the LIB_* enumeration corresponding to the category specified in the Category parameter. The categories and their associated field enumerations are listed in the following table.

Category from LIB_CATEGORY LIBCAT_ enum
LC_MEMBERTYPE _LIBCAT_MEMBERTYPE
LC_MEMBERACCESS _LIBCAT_MEMBERACCESS
LC_CLASSTYPE _LIBCAT_CLASSTYPE
LC_CLASSACCESS _LIBCAT_CLASSACCESS
LC_ACTIVEPROJECT Unused.
LC_LISTTYPE (Special, see below) LIBCAT_LISTTYPE (typedef of _LIB_LISTTYPE)
LC_VISIBILITY _LIBCAT_VISIBILITY
LC_MODIFIER _LIBCAT_MODIFIERTYPE
LC_NODETYPE (Special, see below) _LIBCAT_NODETYPE

If the index parameter is NULINDEX, the Category parameter is LC_LISTTYPE and the request is for the list as a whole, not a specific list item. This is asking for the child list types supported under this list. In this case you would assign pField one or more of the values from the _LIB_LISTTYPE enumeration. For instance, an LC_CLASSES list may return LC_CLASSES | LC_MEMBERS to indicate that it supports classes and member lists. This does not, however, mean that every list item in this list supports both child lists.

Calling the GetCategoryField method with LC_LISTTYPE category is one way the environment determines if a node is expandable so it can indicate that a '+' symbol should be displayed in the object browser or class view tools. Since computing expandability of a node can be expensive for your library, the environment first calls GetExpandable3. If that method fails, the environment calls GetCategoryField. Use GetExpandable3 if you can determine the expandable state of the list item much faster than fully enumerating all the supported lists under the given item.

Do not implement LC_NODETYPE for non-LLT_HIERARCHY lists. You can return LCNT_SYMBOL for LLT_HIERARCHY lists that are actually symbol lists, however.

Applies to