共用方式為


IVsSimpleObjectList2.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

'Declaration
Function GetCategoryField2 ( _
    index As UInteger, _
    Category As Integer, _
    <OutAttribute> ByRef pfCatField As UInteger _
) As Integer
int GetCategoryField2(
    uint index,
    int Category,
    out uint pfCatField
)
int GetCategoryField2(
    [InAttribute] unsigned int index, 
    [InAttribute] int Category, 
    [OutAttribute] unsigned int% pfCatField
)
abstract GetCategoryField2 : 
        index:uint32 * 
        Category:int * 
        pfCatField:uint32 byref -> int
function GetCategoryField2(
    index : uint, 
    Category : int, 
    pfCatField : uint
) : int

Parameters

  • index
    Type: UInt32

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

  • Category
    Type: Int32

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

  • pfCatField
    Type: UInt32%

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

Return Value

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

Remarks

COM Signature

From vsshell80.idl:

HRESULT IVsSimpleObjectList2::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.

.NET Framework Security

See Also

Reference

IVsSimpleObjectList2 Interface

Microsoft.VisualStudio.Shell.Interop Namespace