本文整理汇总了C++中COMPtr::get_attribute方法的典型用法代码示例。如果您正苦于以下问题:C++ COMPtr::get_attribute方法的具体用法?C++ COMPtr::get_attribute怎么用?C++ COMPtr::get_attribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COMPtr
的用法示例。
在下文中一共展示了COMPtr::get_attribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findAccessibleObjectById
static COMPtr<IAccessible> findAccessibleObjectById(AccessibilityUIElement parentObject, BSTR idAttribute)
{
COMPtr<IAccessible> parentIAccessible = parentObject.platformUIElement();
COMPtr<IServiceProvider> serviceProvider(Query, parentIAccessible);
if (!serviceProvider)
return 0;
COMPtr<IAccessibleComparable> comparable = comparableObject(serviceProvider);
if (!comparable)
return 0;
_variant_t value;
_bstr_t elementIdAttributeKey(L"AXDRTElementIdAttribute");
if (SUCCEEDED(comparable->get_attribute(elementIdAttributeKey, &value.GetVARIANT()))) {
ASSERT(V_VT(&value) == VT_BSTR);
if (VARCMP_EQ == ::VarBstrCmp(value.bstrVal, idAttribute, LOCALE_USER_DEFAULT, 0))
return parentIAccessible;
}
long childCount = parentObject.childrenCount();
if (!childCount)
return nullptr;
COMPtr<IAccessible> result;
for (long i = 0; i < childCount; ++i) {
AccessibilityUIElement childAtIndex = parentObject.getChildAtIndex(i);
result = findAccessibleObjectById(childAtIndex, idAttribute);
if (result)
return result;
}
return nullptr;
}
示例2: titleUIElement
AccessibilityUIElement AccessibilityUIElement::titleUIElement()
{
COMPtr<IAccessible> platformElement = platformUIElement();
COMPtr<IAccessibleComparable> comparable = comparableObject(platformElement.get());
if (!comparable)
return 0;
_variant_t value;
_bstr_t titleUIElementAttributeKey(L"AXTitleUIElementAttribute");
if (FAILED(comparable->get_attribute(titleUIElementAttributeKey, &value.GetVARIANT())))
return nullptr;
if (V_VT(&value) == VT_EMPTY)
return nullptr;
ASSERT(V_VT(&value) == VT_UNKNOWN);
if (V_VT(&value) != VT_UNKNOWN)
return nullptr;
COMPtr<IAccessible> titleElement(Query, value.punkVal);
if (value.punkVal)
value.punkVal->Release();
return titleElement;
}
示例3: selectedTextRange
JSStringRef AccessibilityUIElement::selectedTextRange()
{
COMPtr<IAccessibleComparable> comparable = comparableObject(platformUIElement().get());
if (!comparable)
return JSStringCreateWithCharacters(0, 0);
_variant_t value;
if (FAILED(comparable->get_attribute(_bstr_t(L"AXSelectedTextRangeAttribute"), &value.GetVARIANT())))
return JSStringCreateWithCharacters(0, 0);
ASSERT(V_VT(&value) == VT_BSTR);
return JSStringCreateWithBSTR(value.bstrVal);
}
示例4: titleUIElement
AccessibilityUIElement AccessibilityUIElement::titleUIElement()
{
COMPtr<IAccessible> platformElement = platformUIElement();
COMPtr<IAccessibleComparable> comparable = comparableObject(platformElement.get());
if (!comparable)
return 0;
VARIANT value;
::VariantInit(&value);
_bstr_t titleUIElementAttributeKey(L"AXTitleUIElementAttribute");
if (FAILED(comparable->get_attribute(titleUIElementAttributeKey, &value))) {
::VariantClear(&value);
return 0;
}
if (V_VT(&value) == VT_EMPTY) {
::VariantClear(&value);
return 0;
}
ASSERT(V_VT(&value) == VT_UNKNOWN);
if (V_VT(&value) != VT_UNKNOWN) {
::VariantClear(&value);
return 0;
}
COMPtr<IAccessible> titleElement(Query, value.punkVal);
if (value.punkVal)
value.punkVal->Release();
::VariantClear(&value);
return titleElement;
}