本文整理汇总了C++中Accessible::AnchorCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Accessible::AnchorCount方法的具体用法?C++ Accessible::AnchorCount怎么用?C++ Accessible::AnchorCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Accessible
的用法示例。
在下文中一共展示了Accessible::AnchorCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VariantInit
STDMETHODIMP
ia2AccessibleHyperlink::get_anchor(long aIndex, VARIANT* aAnchor)
{
A11Y_TRYBLOCK_BEGIN
VariantInit(aAnchor);
Accessible* thisObj = static_cast<AccessibleWrap*>(this);
if (thisObj->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
return E_INVALIDARG;
if (!thisObj->IsLink())
return S_FALSE;
AccessibleWrap* anchor =
static_cast<AccessibleWrap*>(thisObj->AnchorAt(aIndex));
if (!anchor)
return S_FALSE;
void* instancePtr = nullptr;
HRESULT result = anchor->QueryInterface(IID_IUnknown, &instancePtr);
if (FAILED(result))
return result;
IUnknown* unknownPtr = static_cast<IUnknown*>(instancePtr);
aAnchor->ppunkVal = &unknownPtr;
aAnchor->vt = VT_UNKNOWN;
return S_OK;
A11Y_TRYBLOCK_END
}
示例2: GetHRESULT
STDMETHODIMP
ia2AccessibleHyperlink::get_anchorTarget(long aIndex, VARIANT* aAnchorTarget)
{
A11Y_TRYBLOCK_BEGIN
VariantInit(aAnchorTarget);
Accessible* thisObj = static_cast<AccessibleWrap*>(this);
if (thisObj->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
return E_INVALIDARG;
if (!thisObj->IsLink())
return S_FALSE;
nsCOMPtr<nsIURI> uri = thisObj->AnchorURIAt(aIndex);
if (!uri)
return S_FALSE;
nsAutoCString prePath;
nsresult rv = uri->GetPrePath(prePath);
if (NS_FAILED(rv))
return GetHRESULT(rv);
nsAutoCString path;
rv = uri->GetPath(path);
if (NS_FAILED(rv))
return GetHRESULT(rv);
nsAutoString stringURI;
AppendUTF8toUTF16(prePath, stringURI);
AppendUTF8toUTF16(path, stringURI);
aAnchorTarget->vt = VT_BSTR;
aAnchorTarget->bstrVal = ::SysAllocStringLen(stringURI.get(),
stringURI.Length());
return aAnchorTarget->bstrVal ? S_OK : E_OUTOFMEMORY;
A11Y_TRYBLOCK_END
}