IVsUserContext::GetAttributePri Method (Int32, String^, Int32, Int32, String^, String^)
Returns a specified attribute or keyword from the context or subcontext bag based on index position, name, or priority.
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
int GetAttributePri( int iAttribute, String^ pszName, int fIncludeChildren, [OutAttribute] int% piPriority, [OutAttribute] String^% pbstrName, [OutAttribute] String^% pbstrValue )
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.
- piPriority
-
Type:
System::Int32
[out] Priority of the attribute or keyword. For a list of piPriority values, see VSUSERCONTEXTPRIORITY.
- 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::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
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. |
