本文整理汇总了C++中ITfRange::GetText方法的典型用法代码示例。如果您正苦于以下问题:C++ ITfRange::GetText方法的具体用法?C++ ITfRange::GetText怎么用?C++ ITfRange::GetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITfRange
的用法示例。
在下文中一共展示了ITfRange::GetText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _InsertAtSelection
HRESULT CDIME::_InsertAtSelection(TfEditCookie ec, _In_ ITfContext *pContext, _In_ CStringRange *pstrAddString, _Outptr_ ITfRange **ppCompRange)
{
debugPrint(L"CDIME::_InsertAtSelection()");
ITfRange* rangeInsert = nullptr;
ITfInsertAtSelection* pias = nullptr;
HRESULT hr = S_OK;
if (ppCompRange == nullptr || pContext == nullptr || pstrAddString == nullptr)
{
debugPrint(L"CDIME::_InsertAtSelection() failed with null ppCompRange or pContext or pstrAddstring");
hr = E_INVALIDARG;
goto Exit;
}
*ppCompRange = nullptr;
hr = pContext->QueryInterface(IID_ITfInsertAtSelection, (void **)&pias);
if (FAILED(hr) || pias == nullptr)
{
debugPrint(L"CDIME::_InsertAtSelection() failed with null pias or QueryInterface failed");
goto Exit;
}
hr = pias->InsertTextAtSelection(ec, TF_IAS_QUERYONLY, pstrAddString->Get(), (LONG)pstrAddString->GetLength(), &rangeInsert);
if ( FAILED(hr) || rangeInsert == nullptr)
{
debugPrint(L"CDIME::_InsertAtSelection() InsertTextAtSelection failed");
rangeInsert = nullptr;
pias->Release();
goto Exit;
}
WCHAR rangeText[256];
rangeText[0] = NULL;
ULONG fetched = 0;
hr = rangeInsert->GetText(ec, 0, rangeText, 256, &fetched);
if (SUCCEEDED(hr) && rangeText)
debugPrint(L"CDIME::_InsertAtSelection() text in range = %s", rangeText);
*ppCompRange = rangeInsert;
pias->Release();
hr = S_OK;
Exit:
return hr;
}