次の方法で共有


IVsObjectList2.GetCategoryField2 Method

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

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)

Syntax

'宣言
Function GetCategoryField2 ( _
    index As UInteger, _
    Category As Integer, _
    <OutAttribute> ByRef pfCatField As UInteger _
) As Integer
'使用
Dim instance As IVsObjectList2
Dim index As UInteger
Dim Category As Integer
Dim pfCatField As UInteger
Dim returnValue As Integer

returnValue = instance.GetCategoryField2(index, _
    Category, pfCatField)
int GetCategoryField2(
    uint index,
    int Category,
    out uint pfCatField
)
int GetCategoryField2(
    [InAttribute] unsigned int index, 
    [InAttribute] int Category, 
    [OutAttribute] unsigned int% pfCatField
)
function GetCategoryField2(
    index : uint, 
    Category : int, 
    pfCatField : uint
) : int

Parameters

  • index
    Type: System.UInt32

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

  • Category
    Type: System.Int32

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

  • pfCatField
    Type: System.UInt32%

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

Return Value

Type: System.Int32

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

Remarks

COM Signature

From vsshell80.idl:

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.

Permissions

See Also

Reference

IVsObjectList2 Interface

IVsObjectList2 Members

Microsoft.VisualStudio.Shell.Interop Namespace