本文整理汇总了C++中QueryInterface函数的典型用法代码示例。如果您正苦于以下问题:C++ QueryInterface函数的具体用法?C++ QueryInterface怎么用?C++ QueryInterface使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QueryInterface函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
nsBaseCommandController::GetInterface(const nsIID& aIID, void** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
if (NS_SUCCEEDED(QueryInterface(aIID, aResult))) {
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIControllerCommandTable))) {
if (mCommandTable) {
return mCommandTable->QueryInterface(aIID, aResult);
}
return NS_ERROR_NOT_INITIALIZED;
}
return NS_NOINTERFACE;
}
开发者ID:70599,项目名称:Waterfox,代码行数:18,代码来源:nsBaseCommandController.cpp
示例2: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP sbSeekableChannel::GetInterface(
const nsIID &iid,
void **ppInterface)
{
void *pInterface = nsnull;
nsresult result = NS_OK;
/* Validate parameters. */
NS_ENSURE_ARG_POINTER(ppInterface);
/* Query component for the interface. */
result = QueryInterface(iid, &pInterface);
/* Return results. */
*ppInterface = pInterface;
return (result);
}
开发者ID:AntoineTurmel,项目名称:nightingale-hacking,代码行数:18,代码来源:SeekableChannel.cpp
示例3: DllGetClassObject
extern "C" HRESULT STDMETHODCALLTYPE DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
// {67fb642f-51cd-4745-8b21-aacd2ec74e62}
const GUID CLSID_CorProfiler = { 0x67fb642f, 0x51cd, 0x4745, { 0x8b, 0x21, 0xaa, 0xcd, 0x2e, 0xc7, 0x4e, 0x62 } };
if (ppv == nullptr || rclsid != CLSID_CorProfiler)
{
return E_FAIL;
}
auto factory = new ClassFactory;
if (factory == nullptr)
{
return E_FAIL;
}
return factory->QueryInterface(riid, ppv);
}
开发者ID:ashmind,项目名称:TryRoslyn,代码行数:18,代码来源:dllmain.cpp
示例4: if
HRESULT tomEditCallback::GetClipboardData(THIS_ CHARRANGE FAR * lpchrg, DWORD reco,
LPDATAOBJECT FAR * lplpdataobj)
{
// 没有选中任何东西
if (lpchrg->cpMin == lpchrg->cpMax)
return E_NOTIMPL ;
// 获得当前选择内容类型:纯文本、单个图像对象、图文混合
WORD selection_type = m_edit->GetSelectionType() ;
if ((selection_type & SEL_TEXT) && !(selection_type & SEL_OBJECT))
{
// 纯文本,执行缺省操作即可
// 但缺省操作会复制富文本的格式、颜色等,所以还得自行处理
return E_NOTIMPL ;
}
else if (selection_type == SEL_OBJECT)
{
// 单个图像对象,要提供CF_BITMAP/CF_DIB、CF_HTML、CF_HDROP和内部标准格式
// 获得图像对象
REOBJECT reo ;
reo.cbStruct = sizeof(reo) ;
reo.cp = lpchrg->cpMin ;
if (S_OK == m_edit->GetObject(REO_IOB_USE_CP, &reo, REO_GETOBJ_POLEOBJ))
{
*lplpdataobj = NULL ;
reo.poleobj->QueryInterface(IID_IDataObject, (void**)lplpdataobj) ;
reo.poleobj->Release() ;
if (*lplpdataobj != NULL)
return S_OK ;
}
}
else if ((selection_type & (SEL_OBJECT)) && (selection_type & SEL_TEXT))
{
// 图文混合
if (PrepareClipboardData() && S_OK == QueryInterface(IID_IDataObject, (void**)lplpdataobj))
{
if (*lplpdataobj != NULL)
return S_OK ;
}
}
return E_NOTIMPL ;
}
开发者ID:baogechen,项目名称:foundit,代码行数:44,代码来源:tomEditCallback.cpp
示例5: GetSite
VALUE CRScriptCore::GetOleObject(VALUE self, LPCOLESTR pstrName)
{
ItemMapIter it = m_mapItem.find(pstrName);
if (it == m_mapItem.end())
{
it = (m_mapItem.insert(ItemMap::value_type(pstrName, new CItemHolder))).first;
}
VALUE obj = Qnil;
IDispatch* pDisp = NULL;
IActiveScriptSite* pSite = GetSite();
if (pSite)
{
pDisp = (*it).second->GetDispatch(pSite, const_cast<LPOLESTR>(pstrName), (m_dwThreadID == GetCurrentThreadId()));
pSite->Release();
}
if (pDisp)
{
oledataex *pole;
// setting free function is not required. because ScriptEngine hold it.
obj = Data_Make_Struct(self, oledataex, 0, 0, pole);
#ifdef __IRubyWrapper_INTERFACE_DEFINED__
IDispatchEx* pEx;
if (QueryInterface(IID_IRubyEngine, (void**)&pole->pEngine) == S_OK)
{
// adjust ref count (because never release the ptr in WIN32OLEEX)
pole->pEngine->Release();
}
if (pDisp->QueryInterface(IID_IDispatchEx, (void**)&pEx) == S_OK)
{
pole->pDispatch = pEx;
pole->pServiceProvider = this;
pDisp->Release();
}
else
#endif
{
pole->pDispatch = pDisp;
}
ATLTRACE(_T("add OLE Object into list:%08X\n"), pole);
m_listOleObj.push_back(reinterpret_cast<oledata*>(pole));
}
return obj;
}
开发者ID:arton,项目名称:RScript20,代码行数:44,代码来源:RScriptCore.cpp
示例6: AddEntity
entity_id_t CComponentManager::AddEntity(const std::wstring& templateName, entity_id_t ent)
{
ICmpTemplateManager *cmpTemplateManager = static_cast<ICmpTemplateManager*> (QueryInterface(SYSTEM_ENTITY, IID_TemplateManager));
if (!cmpTemplateManager)
{
debug_warn(L"No ICmpTemplateManager loaded");
return INVALID_ENTITY;
}
// TODO: should assert that ent doesn't exist
const CParamNode* tmpl = cmpTemplateManager->LoadTemplate(ent, utf8_from_wstring(templateName), -1);
if (!tmpl)
return INVALID_ENTITY; // LoadTemplate will have reported the error
// Construct a component for each child of the root element
const CParamNode::ChildrenMap& tmplChilds = tmpl->GetChildren();
for (CParamNode::ChildrenMap::const_iterator it = tmplChilds.begin(); it != tmplChilds.end(); ++it)
{
// Ignore attributes on the root element
if (it->first.length() && it->first[0] == '@')
continue;
CComponentManager::ComponentTypeId cid = LookupCID(it->first);
if (cid == CID__Invalid)
{
LOGERROR(L"Unrecognised component type name '%hs' in entity template '%ls'", it->first.c_str(), templateName.c_str());
return INVALID_ENTITY;
}
if (!AddComponent(ent, cid, it->second))
{
LOGERROR(L"Failed to construct component type name '%hs' in entity template '%ls'", it->first.c_str(), templateName.c_str());
return INVALID_ENTITY;
}
// TODO: maybe we should delete already-constructed components if one of them fails?
}
CMessageCreate msg(ent);
PostMessage(ent, msg);
return ent;
}
开发者ID:nahumfarchi,项目名称:0ad,代码行数:44,代码来源:ComponentManager.cpp
示例7: V
int DX11Engine::getOutput(IUnknown* pDevice, IUnknown** pOutputs, int sz) const {
auto ptr = reinterpret_cast<ID3D11Device*>(pDevice);
HRESULT hr = S_OK;
std::unique_ptr<IDXGIDevice, COMDeleter> pDXGIDevice;
std::unique_ptr<IDXGIAdapter, COMDeleter> pDXGIAdapter;
V(ptr->QueryInterface(__uuidof(IDXGIDevice), ref(pDXGIDevice)));
V(pDXGIDevice->GetParent(__uuidof(IDXGIAdapter), ref(pDXGIAdapter)));
UINT i = 0;
std::unique_ptr<IDXGIOutput, COMDeleter> pOutput;
while (pDXGIAdapter->EnumOutputs(i, ref(pOutput)) != DXGI_ERROR_NOT_FOUND &&
i < uint32_t(sz))
{
pOutputs[i] = pOutput.release();
++i;
}
return i;
}
开发者ID:Zhou-Zhenglong,项目名称:star,代码行数:19,代码来源:SDX11Engine.cpp
示例8: QueryInterface
NS_INTERFACE_MAP_END
///////////////////////////////////////////////////////////////////////////////
// nsIInterfaceRequestor
NS_IMETHODIMP CWebBrowserContainer::GetInterface(const nsIID & aIID, void * *result)
{
*result = 0;
if (aIID.Equals(NS_GET_IID(nsIDOMWindow)))
{
if (mOwner && mOwner->mWebBrowser)
{
return mOwner->mWebBrowser->GetContentDOMWindow((nsIDOMWindow **) result);
}
return NS_ERROR_NOT_INITIALIZED;
}
return QueryInterface(aIID, result);
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:19,代码来源:WebBrowserContainer.cpp
示例9: QueryInterface
NS_INTERFACE_MAP_END
////////////////////////////////////////////////////////////////////////////////
/* void getInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
NS_IMETHODIMP
BrowserWindow::GetInterface(const nsIID & aIID, void * *aInstancePtr)
{
if ( aIID.Equals( NS_GET_IID( nsIDOMWindow ) ) ) {
if ( webBrowser ) {
return webBrowser->GetContentDOMWindow( ( nsIDOMWindow** )aInstancePtr );
};
return NS_ERROR_NOT_INITIALIZED;
};
return QueryInterface( aIID, aInstancePtr );
}
开发者ID:noqisofon,项目名称:gluezilla,代码行数:19,代码来源:BrowserWindow.cpp
示例10: QueryInterface
HRESULT CDwnDoc::QueryService(BOOL fBindOnApt, REFGUID rguid, REFIID riid, void** ppvObj)
{
HRESULT hr;
if((rguid==IID_IAuthenticate || rguid==IID_IWindowForBindingUI) && (rguid==riid))
{
hr = QueryInterface(rguid, ppvObj);
}
else if(fBindOnApt && IsDocThread() && _pDoc)
{
hr = _pDoc->QueryService(rguid, riid, ppvObj);
}
else
{
*ppvObj = NULL;
hr = E_NOINTERFACE;
}
return hr;
}
开发者ID:hufuman,项目名称:xindows,代码行数:20,代码来源:DwnDoc.cpp
示例11: QueryInterface
HRESULT PendingBreakpoint::SendBoundEvent( IEnumDebugBoundBreakpoints2* enumBPs )
{
HRESULT hr = S_OK;
CComPtr<IDebugPendingBreakpoint2> pendBP;
CComPtr<IDebugEngine2> engine;
RefPtr<BreakpointBoundEvent> event;
hr = QueryInterface( __uuidof( IDebugPendingBreakpoint2 ), (void**) &pendBP );
_ASSERT( hr == S_OK );
hr = mEngine->QueryInterface( __uuidof( IDebugEngine2 ), (void**) &engine );
_ASSERT( hr == S_OK );
hr = MakeCComObject( event );
if ( FAILED( hr ) )
return hr;
event->Init( enumBPs, pendBP );
return event->Send( mCallback, engine, NULL, NULL );
}
开发者ID:Kentorix,项目名称:MagoWrapper,代码行数:21,代码来源:PendingBreakpoint.cpp
示例12: NS_ENSURE_ARG_POINTER
NS_INTERFACE_MAP_END
//*****************************************************************************
// WebBrowserChrome::nsIInterfaceRequestor
//*****************************************************************************
NS_IMETHODIMP WebBrowserChrome::GetInterface(const nsIID &aIID, void** aInstancePtr)
{
NS_ENSURE_ARG_POINTER(aInstancePtr);
*aInstancePtr = 0;
if (aIID.Equals(NS_GET_IID(nsIDOMWindow)))
{
if (mWebBrowser)
{
return mWebBrowser->GetContentDOMWindow((nsIDOMWindow **) aInstancePtr);
}
return NS_ERROR_NOT_INITIALIZED;
}
return QueryInterface(aIID, aInstancePtr);
}
开发者ID:adamroach,项目名称:gecko-dev,代码行数:21,代码来源:WebBrowserChrome.cpp
示例13: NS_ADDREF_THIS
NS_IMETHODIMP
FetchDriver::GetInterface(const nsIID& aIID, void **aResult)
{
if (aIID.Equals(NS_GET_IID(nsIChannelEventSink))) {
*aResult = static_cast<nsIChannelEventSink*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIStreamListener))) {
*aResult = static_cast<nsIStreamListener*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIRequestObserver))) {
*aResult = static_cast<nsIRequestObserver*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
return QueryInterface(aIID, aResult);
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:21,代码来源:FetchDriver.cpp
示例14: lock
HRESULT FFmpegDecodeFilter::GetService(REFIID riid, void** ppv)
{
std::lock_guard<decltype(_mutex)> lock(_mutex);
if (_services == NULL) {
avcodec_register_all();
av_lockmgr_register(&AVCodecMTLockCallback); //or to use InitOnceExecuteOnce.
auto p = new(std::nothrow) FFmpegDecodeServices();
if (p == NULL)
return E_OUTOFMEMORY;
p->QueryInterface(IID_PPV_ARGS(&_services));
p->Release();
}
if (ppv == NULL)
return E_POINTER;
if (_services == NULL)
return E_ABORT;
return _services->QueryInterface(riid, ppv);
}
开发者ID:saki-saki,项目名称:SYEngine,代码行数:21,代码来源:FFmpegDecodeFilter.cpp
示例15: CHECK_E_POINTER
STDMETHODIMP CVideoViewControl::OnInitialized(IServiceProvider *pServiceProvider)
{
CHECK_E_POINTER(pServiceProvider);
m_pServiceProvider = pServiceProvider;
CComPtr<IUnknown> pUnk;
RETURN_IF_FAILED(QueryInterface(__uuidof(IUnknown), (LPVOID*)&pUnk));
STARTUPINFO si = { 0 };
PROCESS_INFORMATION pi = { 0 };
auto wstrParams = std::to_wstring((long long)m_hWnd);
CString strCmdLine(L"minitwivp.exe");
strCmdLine += CString(L" ") + wstrParams.c_str();
TCHAR lpszCmdLine[100];
wcscpy(lpszCmdLine, strCmdLine);
auto res = CreateProcess(
NULL,
lpszCmdLine,
NULL,
NULL,
FALSE,
NULL,
NULL,
NULL,
&si,
&pi
);
if (!res)
{
HRESULT hr = HRESULT_FROM_WIN32(GetLastError());
HandleError(hr);
}
CloseHandle(pi.hThread);
m_hProcess = pi.hProcess;
SetTimer(1, 10 * 1000); //waiting for child process init
return S_OK;
}
开发者ID:ip821,项目名称:minitwi,代码行数:40,代码来源:VideoViewControl.cpp
示例16: CheckPointer
// Retrieves a service interface.
HRESULT STDMETHODCALLTYPE EVRCustomPresenter::GetService(REFGUID guidService, REFIID riid, LPVOID *ppvObject)
{
HRESULT hr = S_OK;
CheckPointer(ppvObject, E_POINTER);
// The only service GUID that we support is MR_VIDEO_RENDER_SERVICE.
if (guidService != MR_VIDEO_RENDER_SERVICE)
{
return MF_E_UNSUPPORTED_SERVICE;
}
// First try to get the service interface from the D3DPresentEngine object.
hr = m_pD3DPresentEngine->GetService(guidService, riid, ppvObject);
if (FAILED(hr))
{
// Next, query interface to check if this object supports the interface.
hr = QueryInterface(riid, ppvObject);
}
return hr;
}
开发者ID:DieBagger,项目名称:MediaPortal-2,代码行数:23,代码来源:IMFGetService.cpp
示例17: cis
void SingleCellViewSimulationData::newIntegrationRun()
{
if (!mRuntime || !mRuntime->isValid())
return;
if (isDAETypeSolver() ? !mRuntime->daeCompiledModel() :
!mRuntime->odeCompiledModel())
return;
ObjRef<iface::cellml_services::CellMLIntegrationService> cis(CreateIntegrationService());
if (isDAETypeSolver())
mIntegrationRun = cis->createDAEIntegrationRun(mRuntime->daeCompiledModel());
else
{
mIntegrationRun = cis->createODEIntegrationRun(mRuntime->odeCompiledModel());
ObjRef<iface::cellml_services::ODESolverRun>
odeRun(QueryInterface(mIntegrationRun));
// TODO have more options than just 'CVODE', allowing user to specify
// which CVODE solver.
odeRun->stepType(iface::cellml_services::BDF_IMPLICIT_1_5_SOLVE);
}
}
开发者ID:A1kmm,项目名称:opencor,代码行数:22,代码来源:singlecellviewsimulation.cpp
示例18: _InitFunctionProviderSink
BOOL CSampleIME::_InitFunctionProviderSink()
{
ITfSourceSingle* pSourceSingle = nullptr;
BOOL ret = FALSE;
if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_ITfSourceSingle, (void **)&pSourceSingle)))
{
IUnknown* punk = nullptr;
if (SUCCEEDED(QueryInterface(IID_IUnknown, (void **)&punk)))
{
if (SUCCEEDED(pSourceSingle->AdviseSingleSink(_tfClientId, IID_ITfFunctionProvider, punk)))
{
if (SUCCEEDED(CSearchCandidateProvider::CreateInstance(&_pITfFnSearchCandidateProvider, (ITfTextInputProcessorEx*)this)))
{
ret = TRUE;
}
}
punk->Release();
}
pSourceSingle->Release();
}
return ret;
}
开发者ID:9578577,项目名称:Windows-classic-samples,代码行数:22,代码来源:FunctionProviderSink.cpp
示例19: CHECK_E_POINTER
STDMETHODIMP CTimelineLoadingService::OnInitialized(IServiceProvider *pServiceProvider)
{
CHECK_E_POINTER(pServiceProvider);
m_pServiceProvider = pServiceProvider;
CComQIPtr<ITimelineControlSupport> pTimelineControlSupport = m_pControl;
ATLASSERT(pTimelineControlSupport);
RETURN_IF_FAILED(pTimelineControlSupport->GetTimelineControl(&m_pTimelineControl));
CComPtr<IUnknown> pUnk;
RETURN_IF_FAILED(QueryInterface(__uuidof(IUnknown), (LPVOID*)&pUnk));
RETURN_IF_FAILED(pServiceProvider->QueryService(SERVICE_TIMELINE_UPDATE_THREAD, &m_pThreadServiceUpdateService));
RETURN_IF_FAILED(AtlAdvise(m_pThreadServiceUpdateService, pUnk, __uuidof(IThreadServiceEventSink), &m_dwAdviceThreadServiceUpdateService));
RETURN_IF_FAILED(pServiceProvider->QueryService(SERVICE_TIMELINE_SHOWMORE_THREAD, &m_pThreadServiceShowMoreService));
if (m_pThreadServiceShowMoreService)
{
RETURN_IF_FAILED(AtlAdvise(m_pThreadServiceShowMoreService, pUnk, __uuidof(IThreadServiceEventSink), &m_dwAdviceThreadServiceShowMoreService));
}
return S_OK;
}
开发者ID:ip821,项目名称:minitwi,代码行数:23,代码来源:TimelineLoadingService.cpp
示例20: pApp
// IOMEventHandler
STDMETHODIMP CEventHandler::Init(DOCSObjects::IApplication * piApp)
{
CComQIPtr<DOCSObjects::IApplication> pApp( piApp );
try
{
VHELPERLib::IVBConnectorPtr pVBConnector;
HRESULT hr = pVBConnector.CreateInstance( __uuidof( VHELPERLib::VBConnector ));
if( SUCCEEDED( hr ))
{
IUnknown* pUnk;
QueryInterface( IID_IUnknown, (void **)&pUnk );
pVBConnector->Connect( pApp, pUnk );
}
}
catch(...)
{
LOG_WS_ERROR(_T("Failed to connect to events source"));
}
return S_OK;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:24,代码来源:EventHandler.cpp
注:本文中的QueryInterface函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论