Partager via


IVsUserContext.GetAttributePri Method

Definition

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

public:
 int GetAttributePri(int iAttribute, System::String ^ pszName, int fIncludeChildren, [Runtime::InteropServices::Out] int % piPriority, [Runtime::InteropServices::Out] System::String ^ % pbstrName, [Runtime::InteropServices::Out] System::String ^ % pbstrValue);
int GetAttributePri(int iAttribute, std::wstring const & pszName, int fIncludeChildren, [Runtime::InteropServices::Out] int & piPriority, [Runtime::InteropServices::Out] std::wstring const & & pbstrName, [Runtime::InteropServices::Out] std::wstring const & & pbstrValue);
public int GetAttributePri (int iAttribute, string pszName, int fIncludeChildren, out int piPriority, out string pbstrName, out string pbstrValue);
abstract member GetAttributePri : int * string * int * int * string * string -> int
Public Function GetAttributePri (iAttribute As Integer, pszName As String, fIncludeChildren As Integer, ByRef piPriority As Integer, ByRef pbstrName As String, ByRef pbstrValue As String) As Integer

Parameters

iAttribute
Int32

[in] Index into the collection of attributes and keywords in the context or subcontext bag.

pszName
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
Int32

[in] If true, then the subcontext elements associated with the context bag are also returned. If true, then the subcontext is excluded.

piPriority
Int32

[out] Priority of the attribute or keyword. For a list of piPriority values, see VSUSERCONTEXTPRIORITY.

pbstrName
String

[out] Pointer to the specific attribute name or the value keyword, if a match is found.

pbstrValue
String

[out, retval] Pointer to the specific attribute value or the keyword text, if a match is found.

Returns

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

Note

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

Applies to