本文整理汇总了C++中IOleObject类的典型用法代码示例。如果您正苦于以下问题:C++ IOleObject类的具体用法?C++ IOleObject怎么用?C++ IOleObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IOleObject类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: GetI
// @pymethod |PyIOleObject|SetClientSite|Description of SetClientSite.
PyObject *PyIOleObject::SetClientSite(PyObject *self, PyObject *args)
{
IOleObject *pIOO = GetI(self);
if ( pIOO == NULL )
return NULL;
// @pyparm <o PyIOleClientSite>|pClientSite||Description for pClientSite
PyObject *obpClientSite;
IOleClientSite * pClientSite;
if ( !PyArg_ParseTuple(args, "O:SetClientSite", &obpClientSite) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpClientSite, IID_IOleClientSite, (void **)&pClientSite, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIOO->SetClientSite( pClientSite );
if (pClientSite) pClientSite->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return OleSetOleError(hr);
Py_INCREF(Py_None);
return Py_None;
}
示例3: Win32HtmlViewRep
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" );
}
示例4: GetI
// @pymethod |PyIOleObject|GetMoniker|Description of GetMoniker.
PyObject *PyIOleObject::GetMoniker(PyObject *self, PyObject *args)
{
IOleObject *pIOO = GetI(self);
if ( pIOO == NULL )
return NULL;
// @pyparm int|dwAssign||Description for dwAssign
// @pyparm int|dwWhichMoniker||Description for dwWhichMoniker
DWORD dwAssign;
DWORD dwWhichMoniker;
IMoniker * ppmk;
if ( !PyArg_ParseTuple(args, "ii:GetMoniker", &dwAssign, &dwWhichMoniker) )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIOO->GetMoniker( dwAssign, dwWhichMoniker, &ppmk );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return OleSetOleError(hr);
PyObject *obppmk;
obppmk = PyCom_PyObjectFromIUnknown(ppmk, IID_IMoniker, FALSE);
PyObject *pyretval = Py_BuildValue("O", obppmk);
Py_XDECREF(obppmk);
return pyretval;
}
示例5: 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());
}
示例6: OnMouseActivate
LRESULT CActiveXWnd::OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
IOleObject* pUnk = NULL;
m_pOwner->m_pOwner->GetControl(IID_IOleObject, (LPVOID*) &pUnk);
if( pUnk == NULL ) return 0;
CSafeRelease<IOleObject> RefOleObject = pUnk;
DWORD dwMiscStatus = 0;
pUnk->GetMiscStatus(DVASPECT_CONTENT, &dwMiscStatus);
if( (dwMiscStatus & OLEMISC_NOUIACTIVATE) != 0 ) return 0;
if( !m_pOwner->m_bInPlaceActive ) DoVerb(OLEIVERB_INPLACEACTIVATE);
bHandled = FALSE;
return 0;
}
示例7: verbs
/*!
\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;
}
示例8: 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;
}
示例9:
duFlash::~duFlash()
{
if (m_pFlash)
{
IOleObject * pObject = NULL;
if (SUCCEEDED(m_pFlash->QueryInterface(IID_IOleObject,(void**)&pObject)))
{
pObject->Close(0);
pObject->Release();
}
m_pFlash->Release();
m_pFlash = NULL;
}
if (m_pContainer)
{
m_pContainer->Release();
m_pContainer = NULL;
}
}
示例10: lck
IEView::~IEView()
{
IOleObject* pOleObject = NULL;
{
mir_cslock lck(mutex);
if (list == this)
list = next;
else if (prev != NULL)
prev->next = next;
if (next != NULL)
next->prev = prev;
prev = NULL;
next = NULL;
}
if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IOleObject, (void**)&pOleObject))) {
pOleObject->SetClientSite(NULL);
pOleObject->Release();
}
else MessageBox(NULL, TranslateT("IID_IOleObject failed."), TranslateT("RESULT"), MB_OK);
if (builder != NULL) {
delete builder;
builder = NULL;
}
if (m_pConnectionPoint != NULL) {
m_pConnectionPoint->Unadvise(m_dwCookie);
m_pConnectionPoint->Release();
}
mir_free(selectedText);
if (sink != NULL)
delete sink;
pWebBrowser->Release();
DestroyWindow(hwnd);
}
示例11: RichEdit_InsertSkin
BOOL RichEdit_InsertSkin(CDuiRichEdit *pRicheditCtrl, CDuiSkinBase *pSkin)
{
IRichEditOle *pRichEditOle=NULL;
LRESULT lRes=pRicheditCtrl->DuiSendMessage(EM_GETOLEINTERFACE,0,(LPARAM)&pRichEditOle);
if(!pRichEditOle) return FALSE;
SCODE sc;
IOleClientSite *pOleClientSite = NULL;
pRichEditOle->GetClientSite(&pOleClientSite);
if (NULL == pOleClientSite)
return FALSE;
IStorage *pStorage = NULL;
LPLOCKBYTES lpLockBytes = NULL;
sc = ::CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes);
if (sc != S_OK)
return FALSE;
sc = ::StgCreateDocfileOnILockBytes(lpLockBytes,
STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_READWRITE, 0, &pStorage);
if (sc != S_OK)
{
lpLockBytes->Release();
lpLockBytes = NULL;
return FALSE;
}
CImageOle *pImageOle = new CImageOle(pRicheditCtrl);
if (NULL == pImageOle)
return FALSE;
pImageOle->SetDuiSkinObj(pSkin);
IOleObject *pOleObject = NULL;
pImageOle->QueryInterface(IID_IOleObject, (void **)&pOleObject);
if (NULL == pOleObject)
{
delete pImageOle;
return FALSE;
}
pImageOle->SetClientSite(pOleClientSite);
HRESULT hr = ::OleSetContainedObject(pOleObject, TRUE);
REOBJECT reobject = {0};
reobject.cbStruct = sizeof(REOBJECT);
reobject.clsid = CLSID_NULL;
reobject.cp = REO_CP_SELECTION;
reobject.dvaspect = DVASPECT_CONTENT;
reobject.poleobj = pOleObject;
reobject.polesite = pOleClientSite;
reobject.pstg = pStorage;
reobject.dwUser = 0;
pRichEditOle->InsertObject(&reobject);
pOleObject->Release();
pOleClientSite->Release();
pStorage->Release();
pRichEditOle->Release();
return TRUE;
}
示例12: AfxThrowOleException
void CImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap)
{
SCODE sc;
// Get the image data object
//
CImageDataObject *pods = new CImageDataObject;
LPDATAOBJECT lpDataObject;
pods->QueryInterface(IID_IDataObject, (void **)&lpDataObject);
pods->SetBitmap(hBitmap);
// Get the RichEdit container site
//
IOleClientSite *pOleClientSite;
pRichEditOle->GetClientSite(&pOleClientSite);
// Initialize a Storage Object
//
IStorage *pStorage;
LPLOCKBYTES lpLockBytes = NULL;
sc = ::CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes);
if (sc != S_OK)
AfxThrowOleException(sc);
ASSERT(lpLockBytes != NULL);
sc = ::StgCreateDocfileOnILockBytes(lpLockBytes,
STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_READWRITE, 0, &pStorage);
if (sc != S_OK)
{
VERIFY(lpLockBytes->Release() == 0);
lpLockBytes = NULL;
AfxThrowOleException(sc);
}
ASSERT(pStorage != NULL);
// The final ole object which will be inserted in the richedit control
//
IOleObject *pOleObject;
pOleObject = pods->GetOleObject(pOleClientSite, pStorage);
if(!pOleObject)
AfxThrowOleException(sc);
// all items are "contained" -- this makes our reference to this object
// weak -- which is needed for links to embedding silent update.
OleSetContainedObject(pOleObject, TRUE);
// Now Add the object to the RichEdit
//
REOBJECT reobject;
ZeroMemory(&reobject, sizeof(REOBJECT));
reobject.cbStruct = sizeof(REOBJECT);
CLSID clsid;
sc = pOleObject->GetUserClassID(&clsid);
if (sc != S_OK)
AfxThrowOleException(sc);
reobject.clsid = clsid;
reobject.cp = REO_CP_SELECTION;
reobject.dvaspect = DVASPECT_CONTENT;
reobject.poleobj = pOleObject;
reobject.polesite = pOleClientSite;
reobject.pstg = pStorage;
// Insert the bitmap at the current location in the richedit control
//
pRichEditOle->InsertObject(&reobject);
// Release all unnecessary interfaces
//
pOleObject->Release();
pOleClientSite->Release();
pStorage->Release();
lpDataObject->Release();
}
示例13:
~Pimpl()
{
if (control != 0)
{
control->Close (OLECLOSE_NOSAVE);
control->Release();
}
clientSite->Release();
storage->Release();
}
示例14:
~Win32HtmlViewRep(){
inPlaceObject->Release();
iBrowser->Release();
oleObject->Close(OLECLOSE_NOSAVE);
oleObject->Release();
}