本文整理汇总了C++中ThrowHr函数的典型用法代码示例。如果您正苦于以下问题:C++ ThrowHr函数的具体用法?C++ ThrowHr怎么用?C++ ThrowHr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ThrowHr函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetModuleFileName
/*----------------------------------------------------------------------------------------------
Static method that returns the path name of the dll or exe.
----------------------------------------------------------------------------------------------*/
LPCTSTR ModuleEntry::GetModulePathName()
{
#if WIN32
if (s_strbpPath.Length() == 0)
{
ULONG cchMod;
s_strbpPath.SetLength(MAX_PATH);
cchMod = GetModuleFileName(s_hmod, &s_strbpPath[0], MAX_PATH);
s_strbpPath.SetLength(cchMod);
if (!cchMod)
ThrowHr(WarnHr(E_FAIL));
}
return s_strbpPath.Chars();
#else
if (s_strbpPath[0] == 0)
{
ULONG cchMod;
cchMod = GetModuleFileName(s_hmod, &s_strbpPath[0], MAX_PATH);
if (!cchMod)
ThrowHr(WarnHr(E_FAIL));
}
return s_strbpPath;
#endif
}
示例2: ThrowHr
/*----------------------------------------------------------------------------------------------
Collapses all Undo items back to a specified mark and creates a single Undo task for
all of them. Also discards the mark. If there are no sequences following the mark, then
simply discard the mark.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ActionHandler::CollapseToMark(int hMark, BSTR bstrUndo, BSTR bstrRedo, ComBool * pf)
{
BEGIN_COM_METHOD;
// It's only valid to collapse to a mark while no action sequence is in progress.
if (m_nDepth > 0)
{
ThrowHr(WarnHr(E_UNEXPECTED));
}
m_fCanContinueTask = false; // Can't merge another action into the current task.
*pf = false; // no actions collapsed yet
// The handle hMark is 1 + the position of the mark in the mark stack.
int iMarkGoal = (hMark == 0) ? m_viMarks.Size() - 1 : hMark - 1;
if (iMarkGoal >= m_viMarks.Size() || iMarkGoal < 0)
ThrowHr(E_INVALIDARG, L"hMark value too great. Don't have that many marks available.");
CleanUpRedoActions(true);
bool fSeqFoundAfterMark = false;
// Find the task the mark points to and delete tasks following the mark.
for (int iuSeq = m_viSeqStart.Size() - 1;
iuSeq >= 0 && m_viSeqStart[iuSeq] >= m_viMarks[iMarkGoal]; iuSeq--)
{
m_viSeqStart.Delete(iuSeq);
m_vstuUndo.Delete(iuSeq);
m_vstuRedo.Delete(iuSeq);
fSeqFoundAfterMark = true;
}
if (fSeqFoundAfterMark)
{
// Now create a new task that includes all the actions following the mark.
m_viSeqStart.Push(m_viMarks[iMarkGoal]);
m_vstuUndo.Push(bstrUndo);
m_vstuRedo.Push(bstrRedo);
// Make sure the current task pointer points to a valid task.
if (m_iCurrSeq >= m_viSeqStart.Size())
m_iCurrSeq = m_viSeqStart.Size() - 1;
m_fCanContinueTask = true; // At this point we DO have an existing task we could append to.
*pf = true;
}
//// Delete all actions that are already undone - after collapsing they can't be
//// redone any more.
//for (int iuAct = m_vquact.Size() - 1; iuAct >= 0 && m_iuactCurr < iuAct; iuAct--)
// m_vquact.Delete(iuAct);
// Delete the mark (and any that follow) we're collapsing to.
for (int iMarkTmp = m_viMarks.Size() - 1; iMarkTmp >= iMarkGoal; iMarkTmp--)
m_viMarks.Delete(iMarkTmp);
END_COM_METHOD(g_factActh, IID_IActionHandler);
}
示例3: switch
const Normalizer2* SilUtil::GetIcuNormalizer(UNormalizationMode mode)
{
UErrorCode uerr = U_ZERO_ERROR;
const Normalizer2* norm = NULL;
switch (mode)
{
case UNORM_NFD:
norm = Normalizer2::getInstance(NULL, "nfc_fw", UNORM2_DECOMPOSE, uerr);
break;
case UNORM_NFC:
norm = Normalizer2::getInstance(NULL, "nfc_fw", UNORM2_COMPOSE, uerr);
break;
case UNORM_NFKD:
norm = Normalizer2::getInstance(NULL, "nfkc_fw", UNORM2_DECOMPOSE, uerr);
break;
case UNORM_NFKC:
norm = Normalizer2::getInstance(NULL, "nfkc_fw", UNORM2_COMPOSE, uerr);
break;
case UNORM_FCD:
norm = Normalizer2::getInstance(NULL, "nfc_fw", UNORM2_FCD, uerr);
break;
}
if (!U_SUCCESS(uerr))
ThrowHr(E_FAIL);
return norm;
}
示例4: Assert
STDMETHODIMP VwInvertedEnv::AddLazyVecItems(int tag, IVwViewConstructor * pvvc, int frag)
{
BEGIN_COM_METHOD;
Assert(false); // "This type of box is not yet supported in inverted views");
ThrowHr(WarnHr(E_NOTIMPL));
END_COM_METHOD(dfactEnv, IID_IVwEnv);
}
示例5: TlsAlloc
/*----------------------------------------------------------------------------------------------
Allocate our TLS slot.
----------------------------------------------------------------------------------------------*/
void TextServGlobals::ProcessAttach(void)
{
#if WIN32
s_luTls = TlsAlloc();
if (0xFFFFFFFF == s_luTls)
ThrowHr(WarnHr(E_FAIL));
#else
if (pthread_key_create(&s_luTls, 0) != 0)
ThrowHr(WarnHr(E_FAIL));
#endif //WIN32
#if WIN32
InitializeCriticalSection(&g_crs);
#else
pthread_mutex_init(&g_crs, 0);
#endif //WIN32
}
示例6: ThrowHr
/*----------------------------------------------------------------------------------------------
Change the size of the data stream.
NOTE: this is not supported by ResourceStream.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ResourceStream::SetSize(ULARGE_INTEGER libNewSize)
{
BEGIN_COM_METHOD;
ThrowHr(WarnHr(STG_E_ACCESSDENIED));
END_COM_METHOD(g_fact, IID_IStream);
}
示例7: ThrowHr
HRESULT VwGraphicsCairo::GetGlyphMetrics(int chw,
int * psBoundingWidth, int * pyBoundingHeight,
int * pxBoundingX, int * pyBoundingY, int * pxAdvanceX, int * pyAdvanceY)
{
BEGIN_COM_METHOD;
ThrowHr(E_NOTIMPL);
END_COM_METHOD(g_fact, IID_IVwGraphics);
}
示例8: AssertPtr
/*----------------------------------------------------------------------------------------------
Called by the GenericFactory to "create" an ITsPropsFactory. It just returns the global
one.
----------------------------------------------------------------------------------------------*/
void TsPropsFact::CreateCom(IUnknown * punkOuter, REFIID iid, void ** ppv)
{
AssertPtr(ppv);
Assert(!*ppv);
if (punkOuter)
ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));
CheckHr(g_tpf.QueryInterface(iid, ppv));
}