本文整理汇总了C++中IOleObject::QueryInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ IOleObject::QueryInterface方法的具体用法?C++ IOleObject::QueryInterface怎么用?C++ IOleObject::QueryInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOleObject
的用法示例。
在下文中一共展示了IOleObject::QueryInterface方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BBString
Win32HtmlViewRep( Win32HtmlView *view, HWND hw,int style ):hwnd(hw){
owner=view;
site.rep=this;
eventsink.rep=this;
frame.rep=this;
viewstyle=style;
emitNavEvent=!!(viewstyle & BBHtmlView::NONAVIGATE);
currenturl=new BBString("");
eventurl=new BBString("");
OleCreate( CLSID_WebBrowser,IID_IOleObject,OLERENDER_DRAW,0,&site,&storage,(void**)&oleObject );
OleSetContainedObject( oleObject,TRUE);
oleObject->SetHostNames(L"Web Host",L"Web View");
oleObject->QueryInterface(IID_IWebBrowser2,(void**)&iBrowser);
oleObject->QueryInterface(IID_IOleInPlaceObject,(void**)&inPlaceObject );
oleObject->QueryInterface(IID_IConnectionPointContainer,(void**)&iConnection);
iConnection->FindConnectionPoint(DIID_DWebBrowserEvents, &iConnectionPoint);
iConnectionPoint->Advise((LPUNKNOWN)&eventsink, &dwCookie);
RECT rect;
::GetClientRect( hwnd,&rect );
oleObject->DoVerb(OLEIVERB_SHOW,NULL,&site,-1,hwnd,&rect);
go( "about:blank" );
}
示例2: ContainerCreate
HRESULT CPdnWnd::ContainerCreate(BOOL popUnder)
{
/* Create the control */
IOleObject* activeXControl =
m_ActiveXHost.Create(m_hWnd, L"Shell.Explorer.2", popUnder);
if(activeXControl == NULL)
{
return E_FAIL;
}
/* Get the webbrowser control and initialize the browser */
HRESULT hr = activeXControl->QueryInterface(IID_IWebBrowser2,
(void**) &m_pBrowser);
if(SUCCEEDED(hr))
{
DWORD dwCookie;
IConnectionPointContainerPtr pCPC;
IConnectionPointPtr pCP;
HRESULT hr = activeXControl->QueryInterface(
IID_IConnectionPointContainer, (LPVOID*) &pCPC);
hr = pCPC->FindConnectionPoint(DIID_DWebBrowserEvents2, &pCP);
hr = pCP->Advise(dynamic_cast<IDispatch*>(this), &dwCookie);
m_pBrowser->put_RegisterAsBrowser(VARIANT_FALSE);
m_pBrowser->put_RegisterAsDropTarget(VARIANT_FALSE);
m_pBrowser->put_Silent(VARIANT_FALSE);
m_pBrowser->Navigate(_bstr_t(m_URL.c_str()), 0, 0, 0, 0);
}
activeXControl->Release();
return hr;
}
示例3: CoCreateInstance
bool WebBrowserContainer::Initialize(HWND parentWindow)
{
this->hwnd = parentWindow;
IOleObject* oleObject = NULL;
HRESULT hRes = CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IOleObject, (void**)&oleObject);
if (FAILED(hRes))
{
Logger::Error("WebBrowserContainer::Inititalize(), CoCreateInstance(CLSID_WebBrowser) failed!, error code %i", hRes);
return false;
}
hRes = oleObject->SetClientSite(this);
if (FAILED(hRes))
{
Logger::Error("WebBrowserContainer::Inititalize(), IOleObject::SetClientSite() failed!, error code %i", hRes);
oleObject->Release();
return false;
}
// Activating the container.
RECT rect = {0};
GetClientRect(hwnd, &rect);
hRes = oleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, this, 0, this->hwnd, &rect);
if (FAILED(hRes))
{
Logger::Error("WebBrowserContainer::InititalizeBrowserContainer(), IOleObject::DoVerb() failed!, error code %i", hRes);
oleObject->Release();
return false;
}
// Prepare the browser itself.
hRes = oleObject->QueryInterface(IID_IWebBrowser2, (void**)&this->webBrowser);
if (FAILED(hRes))
{
Logger::Error("WebViewControl::InititalizeBrowserContainer(), IOleObject::QueryInterface(IID_IWebBrowser2) failed!, error code %i", hRes);
oleObject->Release();
return false;
}
sink = new EventSink();
EventSink* s = (EventSink*)sink;
hRes = s->DispEventAdvise(webBrowser, &DIID_DWebBrowserEvents2);
if (FAILED(hRes))
{
Logger::Error("WebViewControl::InititalizeBrowserContainer(), EventSink::DispEventAdvise(&DIID_DWebBrowserEvents2) failed!, error code %i", hRes);
return false;
}
// Initialization is OK.
oleObject->Release();
return true;
}