本文整理汇总了C++中IDispatch_QueryInterface函数的典型用法代码示例。如果您正苦于以下问题:C++ IDispatch_QueryInterface函数的具体用法?C++ IDispatch_QueryInterface怎么用?C++ IDispatch_QueryInterface使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IDispatch_QueryInterface函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClServiceProvider_QueryService
static HRESULT WINAPI ClServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
REFIID riid, void **ppv)
{
DocHost *This = impl_from_IServiceProvider(iface);
if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
TRACE("(%p)->(IID_IHlinkFrame %s %p)\n", This, debugstr_guid(riid), ppv);
return IDispatch_QueryInterface(This->disp, riid, ppv);
}
if(IsEqualGUID(&IID_IWebBrowserApp, guidService)) {
TRACE("IWebBrowserApp service\n");
return IDispatch_QueryInterface(This->disp, riid, ppv);
}
if(IsEqualGUID(&IID_IShellBrowser, guidService)) {
TRACE("(%p)->(IID_IShellBrowser %s %p)\n", This, debugstr_guid(riid), ppv);
if(!This->browser_service) {
HRESULT hres;
hres = create_browser_service(This, &This->browser_service);
if(FAILED(hres))
return hres;
}
return IShellBrowser_QueryInterface(&This->browser_service->IShellBrowser_iface, riid, ppv);
}
FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
return E_NOINTERFACE;
}
示例2: test_responseXML
static void test_responseXML(const char *expect_text)
{
IDispatch *disp;
IXMLDOMDocument *xmldom;
IObjectSafety *safety;
DWORD enabled = 0, supported = 0;
HRESULT hres;
disp = NULL;
hres = IHTMLXMLHttpRequest_get_responseXML(xhr, &disp);
ok(hres == S_OK, "get_responseXML failed: %08x\n", hres);
ok(disp != NULL, "disp == NULL\n");
xmldom = NULL;
hres = IDispatch_QueryInterface(disp, &IID_IXMLDOMDocument, (void**)&xmldom);
ok(hres == S_OK, "QueryInterface(IXMLDOMDocument) failed: %08x\n", hres);
ok(xmldom != NULL, "xmldom == NULL\n");
hres = IXMLDOMDocument_QueryInterface(xmldom, &IID_IObjectSafety, (void**)&safety);
ok(hres == S_OK, "QueryInterface IObjectSafety failed: %08x\n", hres);
hres = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
ok(hres == S_OK, "GetInterfaceSafetyOptions failed: %08x\n", hres);
ok(broken(supported == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA)) ||
supported == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER) /* msxml3 SP8+ */,
"Expected supported: (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER), got %08x\n", supported);
ok(enabled == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER),
"Expected enabled: (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER), got 0x%08x\n", enabled);
IObjectSafety_Release(safety);
if(!expect_text)
test_illegal_xml(xmldom);
IXMLDOMDocument_Release(xmldom);
IDispatch_Release(disp);
}
示例3: MsiActiveScriptSite_GetItemInfo
static HRESULT WINAPI MsiActiveScriptSite_GetItemInfo(IActiveScriptSite* iface, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown** ppiunkItem, ITypeInfo** ppti)
{
MsiActiveScriptSite *This = impl_from_IActiveScriptSite(iface);
TRACE("(%p)->(%p, %d, %p, %p)\n", This, pstrName, dwReturnMask, ppiunkItem, ppti);
/* Determine the kind of pointer that is requested, and make sure placeholder is valid */
if (dwReturnMask & SCRIPTINFO_ITYPEINFO) {
if (!ppti) return E_INVALIDARG;
*ppti = NULL;
}
if (dwReturnMask & SCRIPTINFO_IUNKNOWN) {
if (!ppiunkItem) return E_INVALIDARG;
*ppiunkItem = NULL;
}
/* Are we looking for the session object? */
if (!strcmpW(szSession, pstrName)) {
if (dwReturnMask & SCRIPTINFO_ITYPEINFO) {
HRESULT hr = get_typeinfo(Session_tid, ppti);
if (SUCCEEDED(hr))
ITypeInfo_AddRef(*ppti);
return hr;
}
else if (dwReturnMask & SCRIPTINFO_IUNKNOWN) {
IDispatch_QueryInterface(This->session, &IID_IUnknown, (void **)ppiunkItem);
return S_OK;
}
}
return TYPE_E_ELEMENTNOTFOUND;
}
示例4: WebBrowser_get_Document
static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
{
WebBrowser *This = impl_from_IWebBrowser2(iface);
IDispatch *disp = NULL;
TRACE("(%p)->(%p)\n", This, ppDisp);
if(This->doc_host.document) {
HRESULT hres;
hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)&disp);
if(SUCCEEDED(hres)) {
IDispatch *html_doc;
/* Some broken apps cast returned IDispatch to IHTMLDocument2
* without QueryInterface call */
hres = IDispatch_QueryInterface(disp, &IID_IHTMLDocument2, (void**)&html_doc);
if(SUCCEEDED(hres)) {
IDispatch_Release(disp);
disp = html_doc;
}
}
}
*ppDisp = disp;
return S_OK;
}
示例5: ResultFromScode
HRESULT _IFUNC BOleFont::QueryInterfaceMain (REFIID iid, LPVOID FAR *ppv)
{
HRESULT hr = ResultFromScode(E_NOINTERFACE);
*ppv = NULL;
// Self
//
if (iid == IID_BOleFont) {
(BOleFont *)*ppv = this;
AddRef();
return NOERROR;
}
// interfaces
if (SUCCEEDED(hr = IFont_QueryInterface (this, iid, ppv))) {
}
else if (SUCCEEDED(hr = IFontDisp_QueryInterface (this, iid, ppv))) {
}
else if (SUCCEEDED(hr = IConnectionPointContainer_QueryInterface(this, iid, ppv))) {
}
else if (SUCCEEDED(hr = IDispatch_QueryInterface(this, iid, ppv))) {
}
else if (SUCCEEDED(hr = BOleComponent::QueryInterfaceMain(iid, ppv))) {
}
return hr;
}
示例6: WindowFromAccessibleObject
HRESULT WINAPI WindowFromAccessibleObject(IAccessible *acc, HWND *phwnd)
{
IDispatch *parent;
IOleWindow *ow;
HRESULT hres;
TRACE("%p %p\n", acc, phwnd);
IAccessible_AddRef(acc);
while(1) {
hres = IAccessible_QueryInterface(acc, &IID_IOleWindow, (void**)&ow);
if(SUCCEEDED(hres)) {
hres = IOleWindow_GetWindow(ow, phwnd);
IOleWindow_Release(ow);
IAccessible_Release(acc);
return hres;
}
hres = IAccessible_get_accParent(acc, &parent);
IAccessible_Release(acc);
if(FAILED(hres))
return hres;
if(hres!=S_OK || !parent) {
*phwnd = NULL;
return hres;
}
hres = IDispatch_QueryInterface(parent, &IID_IAccessible, (void**)&acc);
IDispatch_Release(parent);
if(FAILED(hres))
return hres;
}
}
示例7: ControlSite_TranslateAccelerator
static HRESULT WINAPI ControlSite_TranslateAccelerator(IOleControlSite *iface, MSG *pMsg,
DWORD grfModifiers)
{
DocHost *This = impl_from_IOleControlSite(iface);
IOleObject *wb_obj;
IOleClientSite *clientsite;
IOleControlSite *controlsite;
HRESULT hr;
TRACE("(%p)->(%p, %08x)\n", This, pMsg, grfModifiers);
hr = IDispatch_QueryInterface(This->disp, &IID_IOleObject, (void**)&wb_obj);
if(SUCCEEDED(hr)) {
hr = IOleObject_GetClientSite(wb_obj, &clientsite);
if(SUCCEEDED(hr)) {
hr = IOleClientSite_QueryInterface(clientsite, &IID_IOleControlSite, (void**)&controlsite);
if(SUCCEEDED(hr)) {
hr = IOleControlSite_TranslateAccelerator(controlsite, pMsg, grfModifiers);
IOleControlSite_Release(controlsite);
}
IOleClientSite_Release(clientsite);
}
IOleObject_Release(wb_obj);
}
if(FAILED(hr))
return S_FALSE;
else
return hr;
}
示例8: MsiActiveScriptSite_GetItemInfo
static HRESULT WINAPI MsiActiveScriptSite_GetItemInfo(IActiveScriptSite* iface, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown** ppiunkItem, ITypeInfo** ppti)
{
MsiActiveScriptSite *This = (MsiActiveScriptSite *)iface;
TRACE("(%p/%p)->(%p,%d,%p,%p)\n", This, iface, pstrName, dwReturnMask, ppiunkItem, ppti);
/* Determine the kind of pointer that is requested, and make sure placeholder is valid */
if (dwReturnMask & SCRIPTINFO_ITYPEINFO) {
if (!ppti) return E_INVALIDARG;
*ppti = NULL;
}
if (dwReturnMask & SCRIPTINFO_IUNKNOWN) {
if (!ppiunkItem) return E_INVALIDARG;
*ppiunkItem = NULL;
}
/* Are we looking for the session object? */
if (!strcmpW(szSession, pstrName)) {
if (dwReturnMask & SCRIPTINFO_ITYPEINFO)
return load_type_info(This->pSession, ppti, &DIID_Session, 0);
else if (dwReturnMask & SCRIPTINFO_IUNKNOWN) {
IDispatch_QueryInterface(This->pSession, &IID_IUnknown, (void **)ppiunkItem);
return S_OK;
}
}
return TYPE_E_ELEMENTNOTFOUND;
}
示例9: create_xmlhttprequest
static void create_xmlhttprequest(IHTMLDocument2 *doc)
{
IHTMLWindow2 *window;
IHTMLWindow5 *window5;
VARIANT var;
IHTMLXMLHttpRequestFactory *factory;
HRESULT hres;
hres = IHTMLDocument2_get_parentWindow(doc, &window);
ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
ok(window != NULL, "window == NULL\n");
hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow5, (void**)&window5);
IHTMLWindow2_Release(window);
if(FAILED(hres)) {
win_skip("IHTMLWindow5 not supported\n");
return;
}
VariantInit(&var);
hres = IHTMLWindow5_get_XMLHttpRequest(window5, &var);
IHTMLWindow5_Release(window5);
ok(hres == S_OK, "get_XMLHttpRequest failed: %08x\n", hres);
ok(V_VT(&var) == VT_DISPATCH, "V_VT(&var) is %08x, expected VT_DISPATCH\n", V_VT(&var));
hres = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IHTMLXMLHttpRequestFactory, (void**)&factory);
VariantClear(&var);
ok(hres == S_OK, "QueryInterface(IID_IHTMLXMLHttpRequestFactory) failed: %08x\n", hres);
ok(factory != NULL, "factory == NULL\n");
hres = IHTMLXMLHttpRequestFactory_create(factory, &xhr);
IHTMLXMLHttpRequestFactory_Release(factory);
ok(hres == S_OK, "create failed: %08x\n", hres);
ok(xhr != NULL, "xhr == NULL\n");
}
示例10: test_interfaces
static void test_interfaces(void)
{
static const WCHAR pathW[] = {'p','a','t','h',0};
HRESULT hr;
IDispatch *disp;
IDispatchEx *dispex;
IFileSystem3 *fs3;
IObjectWithSite *site;
VARIANT_BOOL b;
BSTR path;
hr = CoCreateInstance(&CLSID_FileSystemObject, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IDispatch, (void**)&disp);
if(FAILED(hr)) {
win_skip("Could not create FileSystem object: %08x\n", hr);
return;
}
hr = IDispatch_QueryInterface(disp, &IID_IFileSystem3, (void**)&fs3);
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
hr = IDispatch_QueryInterface(disp, &IID_IObjectWithSite, (void**)&site);
ok(hr == E_NOINTERFACE, "got 0x%08x, expected 0x%08x\n", hr, E_NOINTERFACE);
hr = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
ok(hr == E_NOINTERFACE, "got 0x%08x, expected 0x%08x\n", hr, E_NOINTERFACE);
b = VARIANT_TRUE;
hr = IFileSystem3_FileExists(fs3, NULL, &b);
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
ok(b == VARIANT_FALSE, "got %x\n", b);
hr = IFileSystem3_FileExists(fs3, NULL, NULL);
ok(hr == E_POINTER, "got 0x%08x, expected 0x%08x\n", hr, E_POINTER);
path = SysAllocString(pathW);
b = VARIANT_TRUE;
hr = IFileSystem3_FileExists(fs3, path, &b);
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
ok(b == VARIANT_FALSE, "got %x\n", b);
SysFreeString(path);
IFileSystem3_Release(fs3);
IDispatch_Release(disp);
}
示例11: dispatch_event
HRESULT dispatch_event(HTMLDOMNode *node, const WCHAR *event_name, VARIANT *event_var, VARIANT_BOOL *cancelled)
{
HTMLEventObj *event_obj = NULL;
eventid_t eid;
HRESULT hres;
eid = attr_to_eid(event_name);
if(eid == EVENTID_LAST) {
WARN("unknown event %s\n", debugstr_w(event_name));
return E_INVALIDARG;
}
if(event_var && V_VT(event_var) != VT_EMPTY && V_VT(event_var) != VT_ERROR) {
if(V_VT(event_var) != VT_DISPATCH) {
FIXME("event_var %s not supported\n", debugstr_variant(event_var));
return E_NOTIMPL;
}
if(V_DISPATCH(event_var)) {
IHTMLEventObj *event_iface;
hres = IDispatch_QueryInterface(V_DISPATCH(event_var), &IID_IHTMLEventObj, (void**)&event_iface);
if(FAILED(hres)) {
FIXME("No IHTMLEventObj iface\n");
return hres;
}
event_obj = unsafe_impl_from_IHTMLEventObj(event_iface);
if(!event_obj) {
ERR("Not our IHTMLEventObj?\n");
IHTMLEventObj_Release(event_iface);
return E_FAIL;
}
}
}
if(event_obj) {
hres = set_event_info(event_obj, node, eid, NULL);
if(SUCCEEDED(hres))
fire_event_obj(node->doc, eid, event_obj, node->nsnode, NULL);
IHTMLEventObj_Release(&event_obj->IHTMLEventObj_iface);
if(FAILED(hres))
return hres;
}else {
if(!(event_info[eid].flags & EVENT_DEFAULTLISTENER)) {
FIXME("not EVENT_DEFAULTEVENTHANDLER\n");
return E_NOTIMPL;
}
fire_event(node->doc, eid, TRUE, node->nsnode, NULL, NULL);
}
*cancelled = VARIANT_TRUE; /* FIXME */
return S_OK;
}
示例12: ClServiceProvider_QueryService
static HRESULT WINAPI ClServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
REFIID riid, void **ppv)
{
DocHost *This = SERVPROV_THIS(iface);
if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
TRACE("(%p)->(IID_IHlinkFrame %s %p)\n", This, debugstr_guid(riid), ppv);
return IDispatch_QueryInterface(This->disp, riid, ppv);
}
FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
return E_NOINTERFACE;
}
示例13: VBScriptRegExpFactory_CreateInstance
HRESULT WINAPI VBScriptRegExpFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv)
{
IDispatch *regexp;
HRESULT hres;
TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv);
hres = create_regexp(®exp);
if(FAILED(hres))
return hres;
hres = IDispatch_QueryInterface(regexp, riid, ppv);
IDispatch_Release(regexp);
return hres;
}
示例14: IActiveScript_GetScriptDispatch
static IDispatchEx *get_script_dispatch(IActiveScript *script)
{
IDispatchEx *dispex;
IDispatch *disp;
HRESULT hres;
disp = (void*)0xdeadbeef;
hres = IActiveScript_GetScriptDispatch(script, NULL, &disp);
ok(hres == S_OK, "GetScriptDispatch failed: %08x\n", hres);
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
IDispatch_Release(disp);
ok(hres == S_OK, "Could not get IDispatch iface: %08x\n", hres);
return dispex;
}
示例15: disp_propput
HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, DISPPARAMS *dp)
{
IDispatchEx *dispex;
EXCEPINFO ei = {0};
HRESULT hres;
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
if(SUCCEEDED(hres)) {
hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, dp, NULL, &ei, NULL /* FIXME! */);
IDispatchEx_Release(dispex);
}else {
ULONG err = 0;
TRACE("using IDispatch\n");
hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, dp, NULL, &ei, &err);
}
return hres;
}