本文整理汇总了C++中CheckHr函数的典型用法代码示例。如果您正苦于以下问题:C++ CheckHr函数的具体用法?C++ CheckHr怎么用?C++ CheckHr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckHr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AssertPtr
void SampleInterface::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
AssertPtr(ppv);
Assert(!*ppv);
if (punkCtl)
ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));
ComSmartPtr<SampleInterface> qxsi;
qxsi.Attach(NewObj SampleInterface()); // ref count initialy 1
CheckHr(qxsi->QueryInterface(riid, ppv));
}
示例2: AssertPtr
void RomRenderEngine::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
AssertPtr(ppv);
Assert(!*ppv);
if (punkCtl)
ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));
ComSmartPtr<RomRenderEngine> qrre;
qrre.Attach(NewObj RomRenderEngine()); // ref count initialy 1
CheckHr(qrre->QueryInterface(riid, ppv));
}
示例3: AssertPtr
void LgKeymanHandler::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
AssertPtr(ppv);
Assert(!*ppv);
if (punkCtl)
ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));
ComSmartPtr<LgKeymanHandler> qlkh;
qlkh.Attach(NewObj LgKeymanHandler()); // ref count initialy 1
CheckHr(qlkh->QueryInterface(riid, ppv));
}
示例4: AssertPtr
/*----------------------------------------------------------------------------------------------
Static method to create an instance of FwDbMergeStyles.
----------------------------------------------------------------------------------------------*/
void FwDbMergeStyles::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
AssertPtr(ppv);
Assert(!*ppv);
if (punkCtl)
ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));
ComSmartPtr<FwDbMergeStyles> qzfwst;
qzfwst.Attach(NewObj FwDbMergeStyles()); // ref count initially 1
CheckHr(qzfwst->QueryInterface(riid, ppv));
}
示例5: MakeTextSelection
void ViewTest2::TestMakeTextSelection()
{
VwSelLevInfo vsli;
vsli.ihvo=-1;
vsli.cpropPrevious = 0;
vsli.tag = kflidStText_Paragraphs;
m_psts->Output(" FUNCTION: MakeTextSelection(0, 1, &vsli, kflidStTxtPara_Contents, 0, 5, "
"25, 0, false, 2))\n");
CheckHr(m_qrootb->MakeTextSelection(0, 1, &vsli, kflidStTxtPara_Contents, 0, 5, 25, 0,
false, 2));
m_psts->Output("\n Now Testing DestroySelection()\n");
CheckHr(m_qrootb->DestroySelection());
m_psts->Output(" FUNCTION: MakeTextSelection(0, 1, &vsli, kflidStTxtPara_Contents, 0, 5, "
"25, 0, false, 0))\n");
CheckHr(m_qrootb->MakeTextSelection(0, 1, &vsli, kflidStTxtPara_Contents, 0, 5, 25, 0,
false, 0));
m_psts->Output(" FUNCTION: MakeTextSelection(0, 1, &vsli, kflidStTxtPara_Contents, 0, 5, "
"25, 0, false, 0))\n");
CheckHr(m_qrootb->MakeTextSelection(0, 1, &vsli, kflidStTxtPara_Contents, 0, 5, 25, 0,
false, 0));
m_psts->Output("MULTIPLE ENTRY");
m_psts->Output(" FUNCTION: MakeTextSelection(0, 1, &vsli, kflidStTxtPara_Contents, 0, 25, "
"75, 0, false, 1))\n");
CheckHr(m_qrootb->MakeTextSelection(0, 1, &vsli, kflidStTxtPara_Contents, 0, 25, 75, 0,
false, 1));
m_psts->Output(" FUNCTION: MakeTextSelection(0, 1, &vsli, kflidStTxtPara_Contents, 0, 5, "
"25, 0, false, -1))\n");
CheckHr(m_qrootb->MakeTextSelection(0, 1, &vsli, kflidStTxtPara_Contents, 0, 5, 25, 0,
false, -1));
}
示例6: AssertPtrN
/*----------------------------------------------------------------------------------------------
Set the text of the control to be equal to ptss. If ptss is NULL, the edit box is cleared.
Message: FW_EM_SETTEXT.
----------------------------------------------------------------------------------------------*/
void TssEdit::SetText(ITsString * ptss)
{
AssertPtrN(ptss); // NULL can be used to clear string.
Assert(m_qcda);
ITsStringPtr qtss = ptss;
if (!ptss)
{
ITsStrFactoryPtr qtsf;
qtsf.CreateInstance(CLSID_TsStrFactory);
CheckHr(qtsf->MakeStringRgch(L"", 0, m_wsBase, &qtss));
}
ITsStringPtr qtssOld;
CheckHr(m_qcda->get_StringProp(khvoString, ktagString, &qtssOld));
int cchOld;
CheckHr(qtssOld->get_Length(&cchOld));
CheckHr(m_qcda->CacheStringProp(khvoString, ktagString, qtss));
int cchNew;
CheckHr(qtss->get_Length(&cchNew));
// Pretend the whole length has been deleted and the whole new inserted.
CheckHr(m_qcda->PropChanged(NULL, kpctNotifyAll, khvoString, ktagString, 0, cchNew, cchOld));
OnUpdate();
::UpdateWindow(m_hwnd);
OnChange();
}
示例7: AssertPtr
void DebugReport::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
AssertPtr(ppv);
Assert(!*ppv);
if (punkCtl)
{
ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));
}
ComSmartPtr<DebugReport> qdbr;
// Ref count initially 1
qdbr.Attach(NewObj DebugReport());
CheckHr(qdbr->QueryInterface(riid, ppv));
}
示例8: AssertPtr
void ActionHandler::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
AssertPtr(ppv);
Assert(!*ppv);
if (punkCtl)
{
ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));
}
ComSmartPtr<ActionHandler> qzacth;
// Ref count initially 1
qzacth.Attach(NewObj ActionHandler());
CheckHr(qzacth->QueryInterface(riid, ppv));
}
示例9: Assert
/*----------------------------------------------------------------------------------------------
Selects a range of characters.
Message: EM_SETSEL.
----------------------------------------------------------------------------------------------*/
void TssEdit::SetSel(int ichAnchor, int ichEnd)
{
Assert(m_qrootb);
int cch = 0;
ITsStringPtr qtss;
CheckHr(m_qcda->get_StringProp(khvoString, ktagString, &qtss));
if (qtss)
CheckHr(qtss->get_Length(&cch));
if (ichAnchor < 0)
ichAnchor = cch;
if (ichEnd < 0)
ichEnd = cch;
if (ichAnchor > cch)
ichAnchor = cch;
// This can happen; apparently when a tab brings the focus to this window, Windows passes
// a large number rather than -1 to set the end of the range.
if (ichEnd > cch)
ichEnd = cch;
CheckHr(m_qrootb->MakeTextSelection(0, 0, NULL, ktagString, 0, ichAnchor, ichEnd, 0, true,
-1, NULL, true, NULL));
}
示例10: StrUni
void ViewTest2::WrapOnTyping(char *pchinput, int _cchBackspace, int _cchDelForward,
char *_chFirst, RECT _rcSrc, RECT _rcDst)
{
OLECHAR oleChar = _chFirst[0];
SmartBstr _bstrInput = StrUni(pchinput).Bstr();
m_psts->OutputFormat(" FUNCTION: OnTyping(m_qvg, \"%s\", %d, %d, '%s', {%d,%d,%d,%d}, "
"{%d,%d,%d,%d})\n", pchinput, _cchBackspace, _cchDelForward, _chFirst, _rcSrc.left,
_rcSrc.top, _rcSrc.right, _rcSrc.bottom, _rcDst.left, _rcDst.top, _rcDst.right,
_rcDst.bottom);
CheckHr(m_qrootb->OnTyping(m_qvg, _bstrInput, _cchBackspace, _cchDelForward, oleChar,
_rcSrc, _rcDst));
}
示例11: Failure
void ViewTest1::TestGuid()
{
OLECHAR rgchGuid[9] = L"B8A6E680";
OLECHAR rgchGuid2[9];
// Send NULL pointers
HRESULT hr = m_qxvoTest->put_Guid(NULL);
if (!FAILED(hr))
Failure("Call to function put_Guid(NULL) should have returned an error");
hr = m_qxvoTest->get_Guid(NULL);
if (!FAILED(hr))
Failure("Call to function get_Guid(NULL) should have returned an error");
// Valid test
CheckHr(m_qxvoTest->put_Guid(rgchGuid));
CheckHr(m_qxvoTest->get_Guid(rgchGuid2));
// Compare the two guids and report, result should be > or < 0
if (wcscmp(rgchGuid, rgchGuid2))
Failure("Guid function returned wrong result");
}
示例12: CheckHr
/*----------------------------------------------------------------------------------------------
Return the size of the text, in points.
Not part of ITextSource interface; specific to FwGrTxtSrc.
----------------------------------------------------------------------------------------------*/
float FwGrTxtSrc::GetFontSize(int ich)
{
LgCharRenderProps lgchrp;
int ichMinBogus, ichLimBogus;
GrResult res = (GrResult)m_qts->GetCharProps(ich, &lgchrp, &ichMinBogus, &ichLimBogus);
int dympHeight = lgchrp.dympHeight;
if(lgchrp.ssv != kssvOff)
{
// psuedo device context works since we are getting proportions which are invariant
HDC hdc = ::CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL);
IVwGraphicsWin32Ptr qvgW;
qvgW.CreateInstance(CLSID_VwGraphicsWin32);
qvgW->Initialize(hdc);
IVwGraphicsPtr qvg;
CheckHr(qvgW->QueryInterface(IID_IVwGraphics, (void **) &qvg));
CheckHr(qvg->SetupGraphics(&lgchrp));
int dSizeNumerator = 1;
int dSizeDenominator = 1;
if (lgchrp.ssv == kssvSuper)
{
CheckHr(qvg->GetSuperscriptHeightRatio(&dSizeNumerator, &dSizeDenominator));
}
else if (lgchrp.ssv == kssvSub)
{
CheckHr(qvg->GetSubscriptHeightRatio(&dSizeNumerator, &dSizeDenominator));
}
dympHeight = gr::GrEngine::GrIntMulDiv(dympHeight, dSizeNumerator, dSizeDenominator);
qvgW.Clear();
qvg.Clear();
::DeleteDC(hdc);
}
return (float)(dympHeight / 1000);
}
示例13: main
int main(int argc, char** argv)
{
try
{
#ifdef WIN32
DllMain(0, DLL_PROCESS_ATTACH, 0);
#endif
IClassFactory* pFact = 0;
CheckHr(DllGetClassObject(CLSID_TestGenericFactory, IID_IClassFactory, (void**)&pFact));
IUnknown* pTest = 0;
CheckHr(pFact->CreateInstance(0, IID_IUnknown, (void**)&pTest));
pFact->Release();
pTest->Release();
#ifdef WIN32
return DllMain(0, DLL_PROCESS_DETACH, 0) ? 0 : 1;
#else
return 0;
#endif
}
catch (Throwable& thr)
{
std::cerr << "Failed HRESULT: " << thr.Error() << "\n";
}
catch (std::exception& e)
{
std::cerr << "Exception: " << e.what() << "\n";
}
catch (...)
{
std::cerr << "Unknown Exception:\n";
}
return 2;
}
示例14: CheckHr
/*----------------------------------------------------------------------------------------------
${IActionHandler#Rollback}
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ActionHandler::Rollback(int nDepth)
{
BEGIN_COM_METHOD;
if (m_nDepth > 0)
{
CheckHr(EndUndoTask());
m_nDepth = nDepth;
// make sure we have something to undo
if (m_iCurrSeq >= 0 && m_fDataChangeAction)
{
UndoResult ures;
CheckHr(Undo(&ures));
// REVIEW (TimS): What should we do if the undo fails?
if (ures == kuresError || ures == kuresFailed)
{
return E_FAIL;
}
CleanUpRedoActions(true);
}
}
return S_OK;
END_COM_METHOD(g_factActh, IID_IActionHandler);
}
示例15: AssertPtr
/*----------------------------------------------------------------------------------------------
Replace the current selection with the specified text.
Message: FW_EM_REPLACESEL.
----------------------------------------------------------------------------------------------*/
void TssEdit::ReplaceSel(ITsString * ptss)
{
AssertPtr(ptss);
AssertPtr(m_qrootb);
IVwSelectionPtr qvwsel;
CheckHr(m_qrootb->get_Selection(&qvwsel));
if (!qvwsel)
{
// If there's not a selection, try to create one at the beginning of the string!
CheckHr(m_qrootb->MakeTextSelection(0, 0, NULL, ktagString, 0, 0, 0, 0, true, -1, NULL,
true, &qvwsel));
if (!qvwsel)
return;
}
CheckHr(qvwsel->ReplaceWithTsString(ptss));
// ReplaceWithTsString should handle this (JohnT, 8-22-01).
//CheckHr(m_qcda->PropChanged(NULL, kpctNotifyAll, khvoString, ktagString, 0, 0, 0));
OnUpdate();
::UpdateWindow(m_hwnd);
OnChange();
}