Compartir a través de


IVsUserContext.GetAttributePri Method

Returns a specified attribute or keyword from the context or subcontext bag based on index position, name, or priority.

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

Syntax

'Declaración
Function GetAttributePri ( _
    iAttribute As Integer, _
    pszName As String, _
    fIncludeChildren As Integer, _
    <OutAttribute> ByRef piPriority As Integer, _
    <OutAttribute> ByRef pbstrName As String, _
    <OutAttribute> ByRef pbstrValue As String _
) As Integer
'Uso
Dim instance As IVsUserContext
Dim iAttribute As Integer
Dim pszName As String
Dim fIncludeChildren As Integer
Dim piPriority As Integer
Dim pbstrName As String
Dim pbstrValue As String
Dim returnValue As Integer

returnValue = instance.GetAttributePri(iAttribute, _
    pszName, fIncludeChildren, piPriority, _
    pbstrName, pbstrValue)
int GetAttributePri(
    int iAttribute,
    string pszName,
    int fIncludeChildren,
    out int piPriority,
    out string pbstrName,
    out string pbstrValue
)
int GetAttributePri(
    [InAttribute] int iAttribute, 
    [InAttribute] String^ pszName, 
    [InAttribute] int fIncludeChildren, 
    [OutAttribute] int% piPriority, 
    [OutAttribute] String^% pbstrName, 
    [OutAttribute] String^% pbstrValue
)
abstract GetAttributePri : 
        iAttribute:int * 
        pszName:string * 
        fIncludeChildren:int * 
        piPriority:int byref * 
        pbstrName:string byref * 
        pbstrValue:string byref -> int 
function GetAttributePri(
    iAttribute : int, 
    pszName : String, 
    fIncludeChildren : int, 
    piPriority : int, 
    pbstrName : String, 
    pbstrValue : String
) : int

Parameters

  • iAttribute
    Type: System.Int32
    [in] Index into the collection of attributes and keywords in the context or subcontext bag.
  • pszName
    Type: System.String
    [in] Attribute name or keyword. Specify the attribute name to access a specific attribute in the context or subcontext bag. Specify keyword to access an F1 or lookup keyword.
  • fIncludeChildren
    Type: System.Int32
    [in] If true, then the subcontext elements associated with the context bag are also returned. If true, then the subcontext is excluded.
  • pbstrName
    Type: System.String%
    [out] Pointer to the specific attribute name or the value keyword, if a match is found.
  • pbstrValue
    Type: System.String%
    [out, retval] Pointer to the specific attribute value or the keyword text, if a match is found.

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 context.idl:

HRESULT IVsUserContext::GetAttributePri(
   [in] int iAttribute,
   [in] LPCOLESTR pszName,
   [in] BOOL fIncludeChildren,
   [out] int *piPriority,
   [out] BSTR * pbstrName,
   [out, retval] BSTR * pbstrValue
);

This method is very similar to the GetAttribute method, but additionally returns the priority of the attribute or keyword in the context or subcontext bag. There are three different ways to use the IVsUserContext.GetAttributePri method:

  • Pass in nulla null reference (Nothing in Visual Basic) for the value of the pszName parameter and iterate through all of the attributes and keywords in the context or subcontext bag using the iAttribute parameter. You can determine the count of attributes and keywords using the CountAttributes method.

  • Iterate through all of the attributes and keywords and pass in a specific attribute name or keyword for the value of the pszName parameter. An attribute name and value or keyword and value are returned in the pbstrName and pbstrValue parameters, respectively, only if the name you provided matched the name in the context or subcontext bag.

  • Pass in a value of -1 for the iAttribute parameter and a specific attribute name or keyword for value of the pszName parameter. The first attribute or keyword that matches the name is returned.

If this method finds a match for the pszName parameter, then it returns S_OK. If the method does not find a match, then it returns E_UNEXPECTED. Thus, it is possible to set the values of the piPriority, pbstrName and pbstrValue parameters to nulla null reference (Nothing in Visual Basic) and evaluate the success or failure of the method based on the return values.

Use the GetAttrUsage method to determine whether keyword returned from the IVsUserContext.GetAttributePri method is an F1 or lookup keyword.

Nota

The value of the fIncludeChildren parameter has no effect if the context bag does not have any subcontext.

.NET Framework Security

See Also

Reference

IVsUserContext Interface

IVsUserContext Members

Microsoft.VisualStudio.Shell.Interop Namespace