本文整理汇总了C++中IOleObject::DoVerb方法的典型用法代码示例。如果您正苦于以下问题:C++ IOleObject::DoVerb方法的具体用法?C++ IOleObject::DoVerb怎么用?C++ IOleObject::DoVerb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOleObject
的用法示例。
在下文中一共展示了IOleObject::DoVerb方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: DoVerb
void CActiveXWnd::DoVerb(LONG iVerb)
{
if( m_pOwner == NULL ) return;
if( m_pOwner->m_pOwner == NULL ) return;
IOleObject* pUnk = NULL;
m_pOwner->m_pOwner->GetControl(IID_IOleObject, (LPVOID*) &pUnk);
if( pUnk == NULL ) return;
CSafeRelease<IOleObject> RefOleObject = pUnk;
IOleClientSite* pOleClientSite = NULL;
m_pOwner->QueryInterface(IID_IOleClientSite, (LPVOID*) &pOleClientSite);
CSafeRelease<IOleClientSite> RefOleClientSite = pOleClientSite;
pUnk->DoVerb(iVerb, NULL, pOleClientSite, 0, m_hWnd, &m_pOwner->m_pOwner->GetPos());
}
示例4: doVerb
/*!
\since 4.1
Requests the COM object to perform the action \a verb. The
possible verbs are returned by verbs().
The function returns true if the object could perform the action, otherwise returns false.
*/
bool QAxObject::doVerb(const QString &verb)
{
if (!verbs().contains(verb))
return false;
IOleObject *ole = 0;
queryInterface(IID_IOleObject, (void**)&ole);
if (!ole)
return false;
LONG index = indexOfVerb(verb);
HRESULT hres = ole->DoVerb(index, 0, 0, 0, 0, 0);
ole->Release();
return hres == S_OK;
}
示例5: OleSetOleError
// @pymethod |PyIOleObject|DoVerb|Description of DoVerb.
PyObject *PyIOleObject::DoVerb(PyObject *self, PyObject *args)
{
IOleObject *pIOO = GetI(self);
if ( pIOO == NULL )
return NULL;
// @pyparm int|iVerb||Description for iVerb
// @pyparm <o PyMSG>|msg||MSG tuple, a-la win32gui etc.
// @pyparm <o PyIOleClientSite>|pActiveSite||Description for pActiveSite
// @pyparm int|lindex||Description for lindex
// @pyparm HWND|hwndParent||Description for hwndParent
// @pyparm (int, int, int, int)|rect||
PyObject *obpActiveSite;
LONG iVerb;
IOleClientSite * pActiveSite;
LONG lindex;
HWND hwndParent;
MSG msg, *lpmsg = NULL;
PyObject *obMsg;
RECT rect;
LPCRECT lprcPosRect = ▭
if ( !PyArg_ParseTuple(args, "iOOii(iiii):DoVerb", &iVerb, &obMsg, &obpActiveSite, &lindex, &hwndParent,
&rect.left, &rect.top, &rect.right, &rect.bottom) )
return NULL;
if (obMsg != Py_None) {
lpmsg = &msg;
if (!PyWinObject_AsMSG(obMsg, &msg))
return NULL;
}
BOOL bPythonIsHappy = TRUE;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpActiveSite, IID_IOleClientSite, (void **)&pActiveSite, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIOO->DoVerb( iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect );
if (pActiveSite) pActiveSite->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return OleSetOleError(hr);
Py_INCREF(Py_None);
return Py_None;
}
示例6: setUserWndProc
IEView::IEView(HWND parent, HTMLBuilder* builder, int x, int y, int cx, int cy) {
MSG msg;
IOleObject* pOleObject = NULL;
IOleInPlaceObject *pOleInPlace;
this->parent = parent;
this->builder = builder;
this->smileyWindow = NULL;
prev = next = NULL;
hwnd = NULL;
sink = NULL;
pWebBrowser = NULL;
m_pConnectionPoint = NULL;
m_cRef = 0;
#ifdef GECKO
if (SUCCEEDED(CoCreateInstance(CLSID_MozillaBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (LPVOID*)&pWebBrowser))) {
#else
if (SUCCEEDED(CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (LPVOID*)&pWebBrowser))) {
#endif
// pWebBrowser->put_RegisterAsBrowser(VARIANT_FALSE);
// pWebBrowser->put_RegisterAsDropTarget(VARIANT_FALSE);
if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IOleObject, (void**)&pOleObject))) {
rcClient.left = x;
rcClient.top = y;
rcClient.right = x + cx;
rcClient.bottom = y + cy;
pOleObject->SetClientSite(this);
pOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, &msg, this, 0, parent, &rcClient);
pOleObject->Release();
} else {
MessageBox(NULL,"IID_IOleObject failed.","RESULT",MB_OK);
}
if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IOleInPlaceObject, (void**)&pOleInPlace))) {
pOleInPlace->GetWindow(&hwnd);
pOleInPlace->Release();
} else {
MessageBox(NULL,"IID_IOleInPlaceObject failed.","RESULT",MB_OK);
}
LONG style = GetWindowLong(hwnd, GWL_EXSTYLE);
style |= (WS_EX_STATICEDGE);
SetWindowLong(hwnd,GWL_EXSTYLE,style);
IConnectionPointContainer* pCPContainer;
// Step 1: Get a pointer to the connection point container.
if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IConnectionPointContainer,
(void**)&pCPContainer))) {
// m_pConnectionPoint is defined like this:
// Step 2: Find the connection point.
if (SUCCEEDED(pCPContainer->FindConnectionPoint(DIID_DWebBrowserEvents2,
&m_pConnectionPoint))) {
// Step 3: Advise the connection point that you
// want to sink its events.
sink = new IEViewSink();
#ifndef GECKO
if (FAILED(m_pConnectionPoint->Advise((IUnknown *)sink, &m_dwCookie))) {
MessageBox(NULL, "Failed to Advise", "C++ Event Sink", MB_OK);
}
#endif
}
pCPContainer->Release();
}
#ifndef GECKO
setUserWndProc((WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC, (LONG) IEViewWindowProcedure));
#endif
}
EnterCriticalSection(&mutex);
next = list;
if (next != NULL) {
next->prev = this;
}
list = this;
LeaveCriticalSection(&mutex);
clear();
}
IEView::IEView(HWND parent, SmileyWindow* smileyWindow, int x, int y, int cx, int cy) {
MSG msg;
IOleObject* pOleObject = NULL;
IOleInPlaceObject *pOleInPlace;
this->parent = parent;
builder = NULL;
this->smileyWindow = smileyWindow;
prev = next = NULL;
hwnd = NULL;
sink = NULL;
pWebBrowser = NULL;
m_pConnectionPoint = NULL;
m_cRef = 0;
#ifdef GECKO
if (SUCCEEDED(CoCreateInstance(CLSID_MozillaBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (LPVOID*)&pWebBrowser))) {
#else
if (SUCCEEDED(CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (LPVOID*)&pWebBrowser))) {
#endif
// pWebBrowser->put_RegisterAsBrowser(VARIANT_FALSE);
// pWebBrowser->put_RegisterAsDropTarget(VARIANT_FALSE);
if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IOleObject, (void**)&pOleObject))) {
rcClient.left = x;
rcClient.top = y;
//.........这里部分代码省略.........
示例7: lck
IEView::IEView(HWND parent, HTMLBuilder* builder, int x, int y, int cx, int cy) {
MSG msg;
IOleObject* pOleObject = NULL;
IOleInPlaceObject *pOleInPlace;
isContactSet = false;
this->parent = parent;
this->builder = builder;
prev = next = NULL;
hwnd = NULL;
sink = NULL;
pWebBrowser = NULL;
m_pConnectionPoint = NULL;
m_cRef = 0;
selectedText = NULL;
getFocus = false;
rcClient.left = x;
rcClient.top = y;
rcClient.right = x + cx;
rcClient.bottom = y + cy;
if (SUCCEEDED(CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (LPVOID*)&pWebBrowser))) {
if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IOleObject, (void**)&pOleObject))) {
pOleObject->SetClientSite(this);
pOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, &msg, this, 0, this->parent, &rcClient);
pOleObject->Release();
} else {
MessageBox(NULL, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
}
if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IOleInPlaceObject, (void**)&pOleInPlace))) {
pOleInPlace->GetWindow(&hwnd);
pOleInPlace->Release();
} else {
MessageBox(NULL, TranslateT("IID_IOleInPlaceObject failed."), TranslateT("RESULT"), MB_OK);
}
setBorder();
IConnectionPointContainer* pCPContainer;
// Step 1: Get a pointer to the connection point container.
if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IConnectionPointContainer,
(void**)&pCPContainer))) {
// m_pConnectionPoint is defined like this:
// Step 2: Find the connection point.
if (SUCCEEDED(pCPContainer->FindConnectionPoint(DIID_DWebBrowserEvents2,
&m_pConnectionPoint))) {
// Step 3: Advise the connection point that you
// want to sink its events.
sink = new IEViewSink(this);
if (FAILED(m_pConnectionPoint->Advise((IUnknown *)sink, &m_dwCookie))) {
MessageBox(NULL, TranslateT("Failed to Advise"), TranslateT("C++ Event Sink"), MB_OK);
}
}
pCPContainer->Release();
}
setMainWndProc((WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) IEViewWindowProcedure));
}
{
mir_cslock lck(mutex);
next = list;
if (next != NULL)
next->prev = this;
list = this;
}
pWebBrowser->put_RegisterAsDropTarget(VARIANT_FALSE);
}