本文整理汇总了C++中HRESULT_CODE函数的典型用法代码示例。如果您正苦于以下问题:C++ HRESULT_CODE函数的具体用法?C++ HRESULT_CODE怎么用?C++ HRESULT_CODE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HRESULT_CODE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mf_createMediaSourceReader
/**
* Creates a Media Source Reader.
*
* @param env JNI env
* @param path path
* @param ppMediaSrcReader media source reader
* @return HRESULT
*/
HRESULT mf_createMediaSourceReader(JNIEnv *env, jstring path, IMFSourceReader **ppMediaSrcReader) {
HRESULT res = S_OK;
const LPWSTR pwszFilePath = (LPWSTR)env->GetStringChars(path, NULL);
res = MFCreateSourceReaderFromURL(
pwszFilePath,
NULL,
ppMediaSrcReader);
if (HRESULT_CODE(res) == ERROR_FILE_NOT_FOUND
|| HRESULT_CODE(res) == ERROR_PATH_NOT_FOUND
|| HRESULT_CODE(res) == ERROR_NOT_DOS_DISK
|| HRESULT_CODE(res) == ERROR_BAD_NETPATH) {
const char * filePath = env->GetStringUTFChars(path, NULL);
throwFileNotFoundExceptionIfError(env, res, filePath);
env->ReleaseStringUTFChars(path, filePath);
goto bail;
}
if (res != S_OK) {
throwUnsupportedAudioFileExceptionIfError(env, res, "Failed to create source reader from url");
goto bail;
}
bail:
env->ReleaseStringChars(path, (jchar *)pwszFilePath);
return res;
}
示例2: VariantInit
void Font21_impl_proxy::ccom_set_charset( EIF_INTEGER a_value )
/*-----------------------------------------------------------
Set No description available.
-----------------------------------------------------------*/
{
HRESULT hr;
if (p_Font21 == NULL)
{
hr = p_unknown->QueryInterface (IID_Font21_, (void **)&p_Font21);
rt.ccom_check_hresult (hr);
};
DISPID disp = (DISPID) 8;
LCID lcid = (LCID) 0;
DISPPARAMS args;
VARIANTARG arg;
SHORT tmp_value;
tmp_value = (SHORT)a_value;
arg.vt = 2;
arg.iVal = tmp_value;
args.cArgs = 1;
args.cNamedArgs = 0;
VARIANT pResult;
VariantInit (&pResult);
excepinfo->wCode = 0;
excepinfo->wReserved = 0;
excepinfo->bstrSource = NULL;
excepinfo->bstrDescription = NULL;
excepinfo->bstrHelpFile = NULL;
excepinfo->dwHelpContext = 0;
excepinfo->pvReserved = NULL;
excepinfo->pfnDeferredFillIn = NULL;
excepinfo->scode = 0;
unsigned int nArgErr;
hr = p_Font21->Invoke (disp, IID_NULL, lcid, DISPATCH_PROPERTYPUT, &args, &pResult, excepinfo, &nArgErr);
if (hr == DISP_E_TYPEMISMATCH || hr == DISP_E_PARAMNOTFOUND)
{
char * hresult_error = f.c_format_message (hr);
char arg_no[20];
itoa (nArgErr, arg_no, 10);
char * arg_name = "Argument No: ";
int size = strlen (hresult_error) + strlen (arg_no) + strlen (arg_name) + 1;
char * message;
message = (char *)calloc (size, sizeof (char));
strcat (message, hresult_error);
strcat (message, arg_no);
strcat (message, arg_name);
com_eraise (message, HRESULT_CODE(hr));
} if (FAILED (hr))
{
com_eraise (f.c_format_message (hr), HRESULT_CODE (hr));
};
};
示例3: Q_UNUSED
QContact QContactWinCEEngine::contact(const QContactLocalId& contactId, const QtMobility::QContactFetchHint& hint, QContactManager::Error* error) const
{
// TODO: implementation for definitionRestrictions!
Q_UNUSED(hint);
QContact ret;
// id == 0 gives a bad argument error from POOM, so don't even try it
if (contactId != 0) {
// Fetch!
SimpleComPointer<IItem> item = 0;
HRESULT hr = d->m_app->GetItemFromOidEx(contactId, 0, &item);
if (SUCCEEDED(hr)) {
if (item) {
*error = QContactManager::NoError;
ret = convertToQContact(item);
} else {
*error = QContactManager::DoesNotExistError;
}
} else {
if (HRESULT_CODE(hr) == ERROR_NOT_FOUND) {
*error = QContactManager::DoesNotExistError;
} else {
qWarning() << "Failed to retrieve contact:" << HRESULT_CODE(hr);
*error = QContactManager::UnspecifiedError;
}
}
} else {
*error = QContactManager::DoesNotExistError;
}
return ret;
}
示例4: NDInstallNetComp
int __stdcall NDInstallNetComp(PCWSTR szNetComp, UINT nc, PCWSTR szInfFullPath)
{
HRESULT hr ;
int iRet;
LogPrintf(TEXT("Entering NDInstallNetProtocol(%s, %d, %s)..."), szNetComp, nc, szInfFullPath);
hr = HrInstallNetComponent(szNetComp, (NetClass) nc, szInfFullPath) ;
LogNetCfgError(hr);
if(SUCCEEDED(hr))
{
if (hr == NETCFG_S_REBOOT)
iRet = NDS_REBOOT_REQUIRED;
else
iRet = NDS_SUCCESS;
}
else if(hr == NETCFG_E_NEED_REBOOT)
{
LogPrintf(TEXT("LpxInstall(), A system reboot is required before the component can be installed."));
iRet = NDS_PREBOOT_REQUIRED;
SetLastError(HRESULT_CODE(hr));
}
else
{
SetLastError(HRESULT_CODE(hr));
iRet = NDS_FAIL;
}
LogPrintf(TEXT("Leaving NDInstallNetProtocol()... %d"), iRet);
return iRet;
}
示例5: ASSERT
egl::Error DXGISwapChainWindowSurfaceWGL::setObjectsLocked(bool locked)
{
if (mRenderbufferBufferHandle == nullptr)
{
ASSERT(mTextureHandle == nullptr);
return egl::NoError();
}
HANDLE resources[] = {
mRenderbufferBufferHandle,
mTextureHandle,
};
GLint count = (mTextureHandle != nullptr) ? 2 : 1;
if (locked)
{
if (!mFunctionsWGL->dxLockObjectsNV(mDeviceHandle, count, resources))
{
return egl::EglBadAlloc()
<< "Failed to lock object, " << gl::FmtErr(HRESULT_CODE(GetLastError()));
}
}
else
{
if (!mFunctionsWGL->dxUnlockObjectsNV(mDeviceHandle, count, resources))
{
return egl::EglBadAlloc()
<< "Failed to lock object, " << gl::FmtErr(HRESULT_CODE(GetLastError()));
}
}
return egl::NoError();
}
示例6: ASSERT
egl::Error DXGISwapChainWindowSurfaceWGL::setObjectsLocked(bool locked)
{
if (mRenderbufferBufferHandle == nullptr)
{
ASSERT(mTextureHandle == nullptr);
return egl::Error(EGL_SUCCESS);
}
HANDLE resources[] = {
mRenderbufferBufferHandle, mTextureHandle,
};
GLint count = (mTextureHandle != nullptr) ? 2 : 1;
if (locked)
{
if (!mFunctionsWGL->dxLockObjectsNV(mDeviceHandle, count, resources))
{
return egl::Error(EGL_BAD_ALLOC, "Failed to lock object, error: 0x%08x.",
HRESULT_CODE(GetLastError()));
}
}
else
{
if (!mFunctionsWGL->dxUnlockObjectsNV(mDeviceHandle, count, resources))
{
return egl::Error(EGL_BAD_ALLOC, "Failed to lock object, error: 0x%08x.",
HRESULT_CODE(GetLastError()));
}
}
return egl::Error(EGL_SUCCESS);
}
示例7: qWarning
bool QContactWinCEEngine::removeContact(const QContactLocalId& contactId, QContactManager::Error* error)
{
// Fetch an IItem* for this
if (contactId != 0) {
SimpleComPointer<IItem> item ;
QContactChangeSet cs;
HRESULT hr = d->m_app->GetItemFromOidEx(contactId, 0, &item);
if (SUCCEEDED(hr)) {
hr = item->Delete();
if (SUCCEEDED(hr)) {
*error = QContactManager::NoError;
d->m_ids.removeAll(contactId);
cs.insertRemovedContact(contactId);
cs.emitSignals(this);
return true;
}
qWarning() << "Failed to delete:" << HRESULT_CODE(hr);
*error = QContactManager::UnspecifiedError;
} else {
if (HRESULT_CODE(hr) == ERROR_NOT_FOUND) {
*error = QContactManager::DoesNotExistError;
} else {
qWarning() << "Failed to retrieve item pointer in delete" << HRESULT_CODE(hr);
*error = QContactManager::UnspecifiedError;
}
}
} else {
// Id 0 does not exist
*error = QContactManager::DoesNotExistError;
}
return false;
}
示例8: LOG
IWebBrowser2* BrowserFactory::CreateBrowser() {
LOG(TRACE) << "Entering BrowserFactory::CreateBrowser";
IWebBrowser2* browser = NULL;
DWORD context = CLSCTX_LOCAL_SERVER;
if (this->ie_major_version_ == 7 && this->windows_major_version_ >= 6) {
// ONLY for IE 7 on Windows Vista. XP and below do not have Protected Mode;
// Windows 7 shipped with IE8.
context = context | CLSCTX_ENABLE_CLOAKING;
}
HRESULT hr = ::CoCreateInstance(CLSID_InternetExplorer,
NULL,
context,
IID_IWebBrowser2,
reinterpret_cast<void**>(&browser));
// When IWebBrowser2::Quit() is called, the wrapper process doesn't
// exit right away. When that happens, CoCreateInstance can fail while
// the abandoned iexplore.exe instance is still valid. The "right" way
// to do this would be to call ::EnumProcesses before calling
// CoCreateInstance, finding all of the iexplore.exe processes, waiting
// for one to exit, and then proceed. However, there is no way to tell
// if a process ID belongs to an Internet Explorer instance, particularly
// when a 32-bit process tries to enumerate 64-bit processes on 64-bit
// Windows. So, we'll take the brute force way out, just retrying the call
// to CoCreateInstance until it succeeds (the old iexplore.exe process has
// exited), or we get a different error code. We'll also set a 45-second
// timeout, with 45 seconds being chosen because it's below the default
// 60 second HTTP request timeout of most language bindings.
if (FAILED(hr) && HRESULT_CODE(hr) == ERROR_SHUTDOWN_IS_SCHEDULED) {
LOG(DEBUG) << "CoCreateInstance for IWebBrowser2 failed due to a "
<< "browser process that has not yet fully exited. Retrying "
<< "until the browser process exits and a new instance can "
<< "be successfully created.";
}
clock_t timeout = clock() + (45 * CLOCKS_PER_SEC);
while (FAILED(hr) &&
HRESULT_CODE(hr) == ERROR_SHUTDOWN_IS_SCHEDULED &&
clock() < timeout) {
::Sleep(500);
hr = ::CoCreateInstance(CLSID_InternetExplorer,
NULL,
context,
IID_IWebBrowser2,
reinterpret_cast<void**>(&browser));
}
if (FAILED(hr) && HRESULT_CODE(hr) != ERROR_SHUTDOWN_IS_SCHEDULED) {
// If we hit this branch, the CoCreateInstance failed due to an unexpected
// error, either before we looped, or at some point during the loop. In
// in either case, there's not much else we can do except log the failure.
LOGHR(WARN, hr) << "CoCreateInstance for IWebBrowser2 failed.";
}
if (browser != NULL) {
browser->put_Visible(VARIANT_TRUE);
}
return browser;
}
示例9: com_eraise
void ecom_runtime::ccom_check_hresult ( HRESULT hr )
/*-----------------------------------------------------------
Checks HRESULT
-----------------------------------------------------------*/
{
if (FAILED (hr))
{
if ((HRESULT_FACILITY (hr) == FACILITY_ITF) && eedefined(HRESULT_CODE (hr) - 1024))
com_eraise (rt_ec.ccom_ec_lpstr (eename (HRESULT_CODE (hr) - 1024), NULL), HRESULT_CODE (hr) - 1024);
com_eraise (f.c_format_message (hr), EN_COM);
};
};
示例10: com_eraise
void ecom_control_library::IOleInPlaceFrame_impl_proxy::ccom_context_sensitive_help( /* [in] */ EIF_INTEGER f_enter_mode )
/*-----------------------------------------------------------
No description available.
-----------------------------------------------------------*/
{
HRESULT hr;
if (p_IOleInPlaceFrame == NULL)
{
hr = p_unknown->QueryInterface (IID_IOleInPlaceFrame_, (void **)&p_IOleInPlaceFrame);
if (FAILED (hr))
{
if ((HRESULT_FACILITY (hr) == FACILITY_ITF) && (HRESULT_CODE (hr) > 1024) && (HRESULT_CODE (hr) < 1053))
com_eraise (rt_ec.ccom_ec_lpstr (eename(HRESULT_CODE (hr) - 1024), NULL),HRESULT_CODE (hr) - 1024);
com_eraise (f.c_format_message (hr), EN_PROG);
};
};
LONG tmp_f_enter_mode = 0;
tmp_f_enter_mode = (LONG)f_enter_mode;
hr = p_IOleInPlaceFrame->ContextSensitiveHelp(tmp_f_enter_mode);
if (FAILED (hr))
{
if ((HRESULT_FACILITY (hr) == FACILITY_ITF) && (HRESULT_CODE (hr) > 1024) && (HRESULT_CODE (hr) < 1053))
com_eraise (rt_ec.ccom_ec_lpstr (eename(HRESULT_CODE (hr) - 1024), NULL),HRESULT_CODE (hr) - 1024);
com_eraise (f.c_format_message (hr), EN_PROG);
};
};
示例11: com_eraise
void ecom_control_library::IOleCache_impl_proxy::ccom_enum_cache( /* [out] */ EIF_OBJECT ppenum_statdata )
/*-----------------------------------------------------------
No description available.
-----------------------------------------------------------*/
{
HRESULT hr;
if (p_IOleCache == NULL)
{
hr = p_unknown->QueryInterface (IID_IOleCache_, (void **)&p_IOleCache);
if (FAILED (hr))
{
if ((HRESULT_FACILITY (hr) == FACILITY_ITF) && (HRESULT_CODE (hr) > 1024) && (HRESULT_CODE (hr) < 1053))
com_eraise (rt_ec.ccom_ec_lpstr (eename(HRESULT_CODE (hr) - 1024), NULL),HRESULT_CODE (hr) - 1024);
com_eraise (f.c_format_message (hr), EN_PROG);
};
};
::IEnumSTATDATA * * tmp_ppenum_statdata = 0;
tmp_ppenum_statdata = (::IEnumSTATDATA * *)grt_ec_control_interfaces2.ccom_ec_pointed_cell_112 (eif_access (ppenum_statdata), NULL);
hr = p_IOleCache->EnumCache(tmp_ppenum_statdata);
if (FAILED (hr))
{
if ((HRESULT_FACILITY (hr) == FACILITY_ITF) && (HRESULT_CODE (hr) > 1024) && (HRESULT_CODE (hr) < 1053))
com_eraise (rt_ec.ccom_ec_lpstr (eename(HRESULT_CODE (hr) - 1024), NULL),HRESULT_CODE (hr) - 1024);
com_eraise (f.c_format_message (hr), EN_PROG);
};
grt_ce_control_interfaces2.ccom_ce_pointed_cell_112 ((::IEnumSTATDATA * *)tmp_ppenum_statdata, ppenum_statdata);
grt_ce_control_interfaces2.ccom_free_memory_pointed_112 (tmp_ppenum_statdata);
};
示例12: com_eraise
void ecom_control_library::IOleUndoManager_impl_proxy::ccom_get_open_parent_state( /* [out] */ EIF_OBJECT pdw_state )
/*-----------------------------------------------------------
No description available.
-----------------------------------------------------------*/
{
HRESULT hr;
if (p_IOleUndoManager == NULL)
{
hr = p_unknown->QueryInterface (IID_IOleUndoManager_, (void **)&p_IOleUndoManager);
if (FAILED (hr))
{
if ((HRESULT_FACILITY (hr) == FACILITY_ITF) && (HRESULT_CODE (hr) > 1024) && (HRESULT_CODE (hr) < 1053))
com_eraise (rt_ec.ccom_ec_lpstr (eename(HRESULT_CODE (hr) - 1024), NULL),HRESULT_CODE (hr) - 1024);
com_eraise (f.c_format_message (hr), EN_PROG);
};
};
ULONG * tmp_pdw_state = 0;
tmp_pdw_state = (ULONG *)rt_ec.ccom_ec_pointed_unsigned_long (eif_access (pdw_state), NULL);
hr = p_IOleUndoManager->GetOpenParentState(tmp_pdw_state);
if (FAILED (hr))
{
if ((HRESULT_FACILITY (hr) == FACILITY_ITF) && (HRESULT_CODE (hr) > 1024) && (HRESULT_CODE (hr) < 1053))
com_eraise (rt_ec.ccom_ec_lpstr (eename(HRESULT_CODE (hr) - 1024), NULL),HRESULT_CODE (hr) - 1024);
com_eraise (f.c_format_message (hr), EN_PROG);
};
rt_ce.ccom_ce_pointed_unsigned_long ((ULONG *)tmp_pdw_state, pdw_state);
grt_ce_control_interfaces2.ccom_free_memory_pointed_171 (tmp_pdw_state);
};
示例13: com_eraise
void ecom_control_library::IPersistMemory_impl_proxy::ccom_get_size_max( /* [out] */ EIF_OBJECT pcb_size )
/*-----------------------------------------------------------
No description available.
-----------------------------------------------------------*/
{
HRESULT hr;
if (p_IPersistMemory == NULL)
{
hr = p_unknown->QueryInterface (IID_IPersistMemory_, (void **)&p_IPersistMemory);
if (FAILED (hr))
{
if ((HRESULT_FACILITY (hr) == FACILITY_ITF) && (HRESULT_CODE (hr) > 1024) && (HRESULT_CODE (hr) < 1053))
com_eraise (rt_ec.ccom_ec_lpstr (eename(HRESULT_CODE (hr) - 1024), NULL),HRESULT_CODE (hr) - 1024);
com_eraise (f.c_format_message (hr), EN_PROG);
};
};
ULONG * tmp_pcb_size = 0;
tmp_pcb_size = (ULONG *)rt_ec.ccom_ec_pointed_unsigned_long (eif_access (pcb_size), NULL);
hr = p_IPersistMemory->GetSizeMax(tmp_pcb_size);
if (FAILED (hr))
{
if ((HRESULT_FACILITY (hr) == FACILITY_ITF) && (HRESULT_CODE (hr) > 1024) && (HRESULT_CODE (hr) < 1053))
com_eraise (rt_ec.ccom_ec_lpstr (eename(HRESULT_CODE (hr) - 1024), NULL),HRESULT_CODE (hr) - 1024);
com_eraise (f.c_format_message (hr), EN_PROG);
};
rt_ce.ccom_ce_pointed_unsigned_long ((ULONG *)tmp_pcb_size, pcb_size);
grt_ce_control_interfaces2.ccom_free_memory_pointed_263 (tmp_pcb_size);
};
示例14: com_eraise
void ecom_control_library::IEnumString_impl_proxy::ccom_skip( /* [in] */ EIF_INTEGER celt )
/*-----------------------------------------------------------
No description available.
-----------------------------------------------------------*/
{
HRESULT hr;
if (p_IEnumString == NULL)
{
hr = p_unknown->QueryInterface (IID_IEnumString_, (void **)&p_IEnumString);
if (FAILED (hr))
{
if ((HRESULT_FACILITY (hr) == FACILITY_ITF) && (HRESULT_CODE (hr) > 1024) && (HRESULT_CODE (hr) < 1053))
com_eraise (rt_ec.ccom_ec_lpstr (eename(HRESULT_CODE (hr) - 1024), NULL),HRESULT_CODE (hr) - 1024);
com_eraise (f.c_format_message (hr), EN_PROG);
};
};
ULONG tmp_celt = 0;
tmp_celt = (ULONG)celt;
hr = p_IEnumString->Skip(tmp_celt);
if (FAILED (hr))
{
if ((HRESULT_FACILITY (hr) == FACILITY_ITF) && (HRESULT_CODE (hr) > 1024) && (HRESULT_CODE (hr) < 1053))
com_eraise (rt_ec.ccom_ec_lpstr (eename(HRESULT_CODE (hr) - 1024), NULL),HRESULT_CODE (hr) - 1024);
com_eraise (f.c_format_message (hr), EN_PROG);
};
};
示例15: com_eraise
void ecom_control_library::IEnumOLEVERB_impl_proxy::ccom_next( /* [in] */ EIF_INTEGER celt, /* [out] */ ecom_control_library::tagOLEVERB * rgelt, /* [out] */ EIF_OBJECT pcelt_fetched )
/*-----------------------------------------------------------
No description available.
-----------------------------------------------------------*/
{
HRESULT hr;
if (p_IEnumOLEVERB == NULL)
{
hr = p_unknown->QueryInterface (IID_IEnumOLEVERB_, (void **)&p_IEnumOLEVERB);
if (FAILED (hr))
{
if ((HRESULT_FACILITY (hr) == FACILITY_ITF) && (HRESULT_CODE (hr) > 1024) && (HRESULT_CODE (hr) < 1053))
com_eraise (rt_ec.ccom_ec_lpstr (eename(HRESULT_CODE (hr) - 1024), NULL),HRESULT_CODE (hr) - 1024);
com_eraise (f.c_format_message (hr), EN_PROG);
};
};
ULONG tmp_celt = 0;
tmp_celt = (ULONG)celt;
ULONG * tmp_pcelt_fetched = 0;
tmp_pcelt_fetched = (ULONG *)rt_ec.ccom_ec_pointed_unsigned_long (eif_access (pcelt_fetched), NULL);
hr = p_IEnumOLEVERB->Next(tmp_celt, (struct tagOLEVERB *)rgelt, tmp_pcelt_fetched);
if (FAILED (hr))
{
if ((HRESULT_FACILITY (hr) == FACILITY_ITF) && (HRESULT_CODE (hr) > 1024) && (HRESULT_CODE (hr) < 1053))
com_eraise (rt_ec.ccom_ec_lpstr (eename(HRESULT_CODE (hr) - 1024), NULL),HRESULT_CODE (hr) - 1024);
com_eraise (f.c_format_message (hr), EN_PROG);
};
rt_ce.ccom_ce_pointed_unsigned_long ((ULONG *)tmp_pcelt_fetched, pcelt_fetched);
grt_ce_control_interfaces2.ccom_free_memory_pointed_177 (tmp_pcelt_fetched);
};