本文整理汇总了C++中IUnknown_QueryInterface函数的典型用法代码示例。如果您正苦于以下问题:C++ IUnknown_QueryInterface函数的具体用法?C++ IUnknown_QueryInterface怎么用?C++ IUnknown_QueryInterface使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IUnknown_QueryInterface函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ICommand_Execute_Stub
HRESULT __RPC_STUB ICommand_Execute_Stub(ICommand* This, IUnknown *pUnkOuter, REFIID riid, HACCESSOR hAccessor,
DB_UPARAMS cParamSets, GUID *pGuid, ULONG ulGuidOffset, RMTPACK *pInputParams,
RMTPACK *pOutputParams, DBCOUNTITEM cBindings, DBBINDING *rgBindings,
DBSTATUS *rgStatus, DBROWCOUNT *pcRowsAffected, IUnknown **ppRowset)
{
IWineRowServer *rowset_server;
IMarshal *marshal;
IUnknown *obj = NULL;
HRESULT hr;
TRACE("(%p)->(%p, %s, %08lx, %d, %p, %d, %p, %p, %d, %p, %p, %p, %p): stub\n", This, pUnkOuter, debugstr_guid(riid),
hAccessor, cParamSets, pGuid, ulGuidOffset, pInputParams, pOutputParams, cBindings, rgBindings, rgStatus,
pcRowsAffected, ppRowset);
*ppRowset = NULL;
hr = CoCreateInstance(&CLSID_wine_rowset_server, NULL, CLSCTX_INPROC_SERVER, &IID_IWineRowServer, (void**)&rowset_server);
if(FAILED(hr)) return hr;
IWineRowServer_GetMarshal(rowset_server, &marshal);
hr = ICommand_Execute(This, (IUnknown*)marshal, &IID_IUnknown, NULL, pcRowsAffected, &obj);
IMarshal_Release(marshal);
if(FAILED(hr))
{
IWineRowServer_Release(rowset_server);
return hr;
}
IWineRowServer_SetInnerUnk(rowset_server, obj);
hr = IUnknown_QueryInterface(obj, riid, (void**)ppRowset);
IUnknown_Release(obj);
return hr;
}
示例2: xslprocessor_put_input
static HRESULT WINAPI xslprocessor_put_input( IXSLProcessor *iface, VARIANT input )
{
xslprocessor *This = impl_from_IXSLProcessor( iface );
IXMLDOMNode *input_node;
HRESULT hr;
TRACE("(%p)->(%s)\n", This, debugstr_variant(&input));
/* try IXMLDOMNode directly first */
if (V_VT(&input) == VT_UNKNOWN)
hr = IUnknown_QueryInterface(V_UNKNOWN(&input), &IID_IXMLDOMNode, (void**)&input_node);
else if (V_VT(&input) == VT_DISPATCH)
hr = IDispatch_QueryInterface(V_DISPATCH(&input), &IID_IXMLDOMNode, (void**)&input_node);
else
{
IXMLDOMDocument *doc;
hr = DOMDocument_create(MSXML_DEFAULT, (void**)&doc);
if (hr == S_OK)
{
VARIANT_BOOL b;
hr = IXMLDOMDocument_load(doc, input, &b);
if (hr == S_OK)
hr = IXMLDOMDocument_QueryInterface(doc, &IID_IXMLDOMNode, (void**)&input_node);
IXMLDOMDocument_Release(doc);
}
}
if (hr == S_OK)
{
if (This->input) IXMLDOMNode_Release(This->input);
This->input = input_node;
}
return hr;
}
示例3: init_texthost
/* Initialize the test texthost structure */
static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
{
ITextHostTestImpl *dummyTextHost;
IUnknown *init;
HRESULT result;
dummyTextHost = CoTaskMemAlloc(sizeof(*dummyTextHost));
if (dummyTextHost == NULL) {
win_skip("Insufficient memory to create ITextHost interface\n");
return FALSE;
}
dummyTextHost->ITextHost_iface.lpVtbl = &itextHostVtbl;
dummyTextHost->refCount = 1;
/* MSDN states that an IUnknown object is returned by
CreateTextServices which is then queried to obtain a
ITextServices object. */
result = pCreateTextServices(NULL, &dummyTextHost->ITextHost_iface, &init);
ok(result == S_OK, "Did not return S_OK when created (result = %x)\n", result);
if (result != S_OK) {
CoTaskMemFree(dummyTextHost);
win_skip("CreateTextServices failed.\n");
return FALSE;
}
result = IUnknown_QueryInterface(init, pIID_ITextServices, (void**)txtserv);
ok((result == S_OK) && (*txtserv != NULL), "Querying interface failed (result = %x, txtserv = %p)\n", result, *txtserv);
IUnknown_Release(init);
if (!((result == S_OK) && (*txtserv != NULL))) {
CoTaskMemFree(dummyTextHost);
win_skip("Could not retrieve ITextServices interface\n");
return FALSE;
}
*ret = &dummyTextHost->ITextHost_iface;
return TRUE;
}
示例4: RevokeBindStatusCallback
/***********************************************************************
* RevokeBindStatusCallback ([email protected])
*
* Unregister a bind status callback.
*
* pbc [I] Binding context
* pbsc [I] Callback to unregister
*
* RETURNS
* Success: S_OK.
* Failure: E_INVALIDARG, if any argument is invalid
*/
HRESULT WINAPI RevokeBindStatusCallback(IBindCtx *pbc, IBindStatusCallback *pbsc)
{
BindStatusCallback *holder;
IBindStatusCallback *callback;
IUnknown *unk;
BOOL dorevoke = FALSE;
HRESULT hres;
TRACE("(%p %p)\n", pbc, pbsc);
if (!pbc || !pbsc)
return E_INVALIDARG;
hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, &unk);
if(FAILED(hres))
return S_OK;
hres = IUnknown_QueryInterface(unk, &IID_IBindStatusCallback, (void**)&callback);
IUnknown_Release(unk);
if(FAILED(hres))
return S_OK;
hres = IBindStatusCallback_QueryInterface(callback, &IID_IBindStatusCallbackHolder, (void**)&holder);
if(SUCCEEDED(hres)) {
if(pbsc == holder->callback)
dorevoke = TRUE;
IBindStatusCallback_Release(STATUSCLB(holder));
}else if(pbsc == callback) {
dorevoke = TRUE;
}
IBindStatusCallback_Release(callback);
if(dorevoke)
IBindCtx_RevokeObjectParam(pbc, BSCBHolder);
return S_OK;
}
示例5: OleDocumentSite_ActivateMe
static HRESULT WINAPI OleDocumentSite_ActivateMe(IOleDocumentSite *iface,
IOleDocumentView *pViewToActivate)
{
DocHost *This = DOCSITE_THIS(iface);
IOleDocument *oledoc;
RECT rect;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, pViewToActivate);
hres = IUnknown_QueryInterface(This->document, &IID_IOleDocument, (void**)&oledoc);
if(FAILED(hres))
return hres;
IOleDocument_CreateView(oledoc, INPLACESITE(This), NULL, 0, &This->view);
IOleDocument_Release(oledoc);
GetClientRect(This->hwnd, &rect);
IOleDocumentView_SetRect(This->view, &rect);
hres = IOleDocumentView_Show(This->view, TRUE);
return hres;
}
示例6: advise_prop_notif
static void advise_prop_notif(DocHost *This, BOOL set)
{
IConnectionPointContainer *cp_container;
IConnectionPoint *cp;
HRESULT hres;
hres = IUnknown_QueryInterface(This->document, &IID_IConnectionPointContainer, (void**)&cp_container);
if(FAILED(hres))
return;
hres = IConnectionPointContainer_FindConnectionPoint(cp_container, &IID_IPropertyNotifySink, &cp);
IConnectionPointContainer_Release(cp_container);
if(FAILED(hres))
return;
if(set)
hres = IConnectionPoint_Advise(cp, (IUnknown*)&This->IPropertyNotifySink_iface, &This->prop_notif_cookie);
else
hres = IConnectionPoint_Unadvise(cp, This->prop_notif_cookie);
IConnectionPoint_Release(cp);
if(SUCCEEDED(hres))
This->is_prop_notif = set;
}
示例7: DocumentMgr_Push
static HRESULT WINAPI DocumentMgr_Push(ITfDocumentMgr *iface, ITfContext *pic)
{
DocumentMgr *This = impl_from_ITfDocumentMgr(iface);
ITfContext *check;
TRACE("(%p) %p\n",This,pic);
if (This->contextStack[1]) /* FUll */
return TF_E_STACKFULL;
if (!pic || FAILED(IUnknown_QueryInterface(pic,&IID_ITfContext,(LPVOID*) &check)))
return E_INVALIDARG;
if (This->contextStack[0] == NULL)
ITfThreadMgrEventSink_OnInitDocumentMgr(This->ThreadMgrSink,iface);
This->contextStack[1] = This->contextStack[0];
This->contextStack[0] = check;
Context_Initialize(check, iface);
ITfThreadMgrEventSink_OnPushContext(This->ThreadMgrSink,check);
return S_OK;
}
示例8: DSCF_CreateInstance
static HRESULT WINAPI DSCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
REFIID riid, void **ppobj)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
HRESULT hres = ERROR_SUCCESS;
LPUNKNOWN punk;
TRACE("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
if (!ppobj)
return E_POINTER;
/* Enforce the normal OLE rules regarding interfaces and delegation */
if (pOuter && !IsEqualGUID(riid, &IID_IUnknown))
return E_NOINTERFACE;
*ppobj = NULL;
punk = This->pfnCreateInstance(pOuter, &hres);
if (!punk)
{
/* No object created, update error if it isn't done already and return */
if (SUCCEEDED(hres))
hres = E_OUTOFMEMORY;
return hres;
}
if (SUCCEEDED(hres))
{
hres = IUnknown_QueryInterface(punk, riid, ppobj);
}
/* Releasing the object. If everything was successful, QueryInterface
should have incremented the refcount once more, otherwise this will
purge the object. */
IUnknown_Release(punk);
return hres;
}
示例9: ITrayBandSiteImpl_Update
static HRESULT
ITrayBandSiteImpl_Update(IN OUT ITrayBandSiteImpl *This)
{
IOleCommandTarget *pOct;
HRESULT hRet;
hRet = IUnknown_QueryInterface(This->punkInner,
&IID_IOleCommandTarget,
(PVOID*)&pOct);
if (SUCCEEDED(hRet))
{
/* Send the DBID_BANDINFOCHANGED command to update the band site */
hRet = IOleCommandTarget_Exec(pOct,
&IID_IDeskBand,
DBID_BANDINFOCHANGED,
0,
NULL,
NULL);
IOleCommandTarget_Release(pOct);
}
return hRet;
}
示例10: detach_plugin_host
void detach_plugin_host(PluginHost *host)
{
HRESULT hres;
TRACE("%p\n", host);
if(!host->doc)
return;
if(host->ip_object) {
if(host->ui_active)
IOleInPlaceObject_UIDeactivate(host->ip_object);
IOleInPlaceObject_InPlaceDeactivate(host->ip_object);
}
if(host->plugin_unk) {
IOleObject *ole_obj;
hres = IUnknown_QueryInterface(host->plugin_unk, &IID_IOleObject, (void**)&ole_obj);
if(SUCCEEDED(hres)) {
if(!host->ip_object)
IOleObject_Close(ole_obj, OLECLOSE_NOSAVE);
IOleObject_SetClientSite(ole_obj, NULL);
IOleObject_Release(ole_obj);
}
}
if(host->element) {
host->element->plugin_host = NULL;
host->element = NULL;
}
list_remove(&host->entry);
list_init(&host->entry);
host->doc = NULL;
}
示例11: IUnknown_QueryInterface
static IDispatchEx *parse_procedure_a(IActiveScriptParse *parser, const char *src)
{
IActiveScriptParseProcedure2 *parse_proc;
IDispatchEx *dispex;
IDispatch *disp;
BSTR str;
HRESULT hres;
hres = IUnknown_QueryInterface(parser, &IID_IActiveScriptParseProcedure2, (void**)&parse_proc);
ok(hres == S_OK, "Coult not get IActiveScriptParseProcedure2: %08x\n", hres);
str = a2bstr(src);
hres = IActiveScriptParseProcedure2_64_ParseProcedureText(parse_proc, str, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, &disp);
SysFreeString(str);
IUnknown_Release(parse_proc);
ok(hres == S_OK, "ParseProcedureText failed: %08x\n", hres);
ok(disp != NULL, "disp == NULL\n");
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
IDispatch_Release(dispex);
ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres);
return dispex;
}
示例12: FileSystemBindData_GetFindData
HRESULT WINAPI FileSystemBindData_GetFindData(LPBC pbc, WIN32_FIND_DATAW *pfd)
{
LPUNKNOWN pUnk;
IFileSystemBindData *pfsbd = NULL;
HRESULT ret;
TRACE("%p, %p\n", pbc, pfd);
if (!pfd)
return E_INVALIDARG;
ret = IBindCtx_GetObjectParam(pbc, (LPOLESTR)wFileSystemBindData, &pUnk);
if (SUCCEEDED(ret))
{
ret = IUnknown_QueryInterface(pUnk, &IID_IFileSystemBindData, (LPVOID *)&pfsbd);
if (SUCCEEDED(ret))
{
ret = IFileSystemBindData_GetFindData(pfsbd, pfd);
IFileSystemBindData_Release(pfsbd);
}
IUnknown_Release(pUnk);
}
return ret;
}
示例13: TransformFilterImpl_QueryInterface
HRESULT WINAPI TransformFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
{
HRESULT hr;
TransformFilter *This = impl_from_IBaseFilter(iface);
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
if (IsEqualIID(riid, &IID_IQualityControl)) {
*ppv = (IQualityControl*)This->qcimpl;
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
else if (IsEqualIID(riid, &IID_IMediaSeeking) ||
IsEqualIID(riid, &IID_IMediaPosition))
{
return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
}
hr = BaseFilterImpl_QueryInterface(iface, riid, ppv);
if (FAILED(hr) && !IsEqualIID(riid, &IID_IPin) && !IsEqualIID(riid, &IID_IVideoWindow) &&
!IsEqualIID(riid, &IID_IAMFilterMiscFlags))
FIXME("No interface for %s!\n", debugstr_guid(riid));
return hr;
}
示例14: test_InternetExplorer
static void test_InternetExplorer(void)
{
IWebBrowser2 *wb;
IUnknown *unk;
ULONG ref;
HRESULT hres;
hres = CoCreateInstance(&CLSID_InternetExplorer, NULL, CLSCTX_SERVER,
&IID_IUnknown, (void**)&unk);
ok(hres == S_OK, "Could not create InternetExplorer instance: %08x\n", hres);
if(hres != S_OK)
return;
hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb);
ok(hres == S_OK, "Could not get IWebBrowser2 interface: %08x\n", hres);
test_visible(wb);
test_html_window(wb);
IWebBrowser2_Release(wb);
ref = IUnknown_Release(unk);
ok(!ref, "object not destroyed, ref=%u\n", ref);
}
示例15: test_AviMux_QueryInterface
static void test_AviMux_QueryInterface(void)
{
IUnknown *avimux, *unk;
HRESULT hr;
hr = CoCreateInstance(&CLSID_AviDest, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&avimux);
ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG),
"couldn't create AVI Mux filter, hr = %08x\n", hr);
if(hr != S_OK) {
win_skip("AVI Mux filter is not registered\n");
return;
}
hr = IUnknown_QueryInterface(avimux, &IID_IBaseFilter, (void**)&unk);
ok(hr == S_OK, "QueryInterface(IID_IBaseFilter) failed: %x\n", hr);
IUnknown_Release(unk);
hr = IUnknown_QueryInterface(avimux, &IID_IConfigAviMux, (void**)&unk);
ok(hr == S_OK, "QueryInterface(IID_IConfigAviMux) failed: %x\n", hr);
IUnknown_Release(unk);
hr = IUnknown_QueryInterface(avimux, &IID_IConfigInterleaving, (void**)&unk);
ok(hr == S_OK, "QueryInterface(IID_IConfigInterleaving) failed: %x\n", hr);
IUnknown_Release(unk);
hr = IUnknown_QueryInterface(avimux, &IID_IMediaSeeking, (void**)&unk);
ok(hr == S_OK, "QueryInterface(IID_IMediaSeeking) failed: %x\n", hr);
IUnknown_Release(unk);
hr = IUnknown_QueryInterface(avimux, &IID_IPersistMediaPropertyBag, (void**)&unk);
ok(hr == S_OK, "QueryInterface(IID_IPersistMediaPropertyBag) failed: %x\n", hr);
IUnknown_Release(unk);
hr = IUnknown_QueryInterface(avimux, &IID_ISpecifyPropertyPages, (void**)&unk);
ok(hr == S_OK, "QueryInterface(IID_ISpecifyPropertyPages) failed: %x\n", hr);
IUnknown_Release(unk);
IUnknown_Release(avimux);
}