コード例 #1
0
ファイル: IEHtmlWin.cpp プロジェクト: Aegisub/traydict
HRESULT LoadWebBrowserFromStream(IWebBrowser* pWebBrowser, IStream* pStream)
{
	HRESULT hr;
	IDispatch* pHtmlDoc = NULL;
	IPersistStreamInit* pPersistStreamInit = NULL;

	// Retrieve the document object.
	hr = pWebBrowser->get_Document( &pHtmlDoc );
	if ( SUCCEEDED(hr) )
	{
		// Query for IPersistStreamInit.
		hr = pHtmlDoc->QueryInterface( IID_IPersistStreamInit,  (void**)&pPersistStreamInit );
		if ( SUCCEEDED(hr) )
		{
			// Initialize the document.
			hr = pPersistStreamInit->InitNew();
			if ( SUCCEEDED(hr) )
			{
				// Load the contents of the stream.
				hr = pPersistStreamInit->Load( pStream );
			}
			pPersistStreamInit->Release();
		}
	}
	return S_OK;
}
コード例 #2
0
ファイル: Utils.cpp プロジェクト: Seldom/miranda-ng
HRESULT TestMarkupServices(BSTR bstrHtml, MarkupCallback *pCallback, BSTR &message)
{
	IHTMLDocument3 *pHtmlDocRoot = NULL;

	// Create the root document -- a "workspace" for parsing.
	HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pHtmlDocRoot));
	if (SUCCEEDED(hr) && pHtmlDocRoot) {
		IPersistStreamInit *pPersistStreamInit = NULL;

		hr = pHtmlDocRoot->QueryInterface(IID_PPV_ARGS(&pPersistStreamInit));
		if (SUCCEEDED(hr)) {
			// Initialize the root document to a default state -- ready for parsing.
			pPersistStreamInit->InitNew();

			IMarkupServices *pMarkupServices = NULL;
			hr = pHtmlDocRoot->QueryInterface(IID_PPV_ARGS(&pMarkupServices));
			if (SUCCEEDED(hr)) {
				IMarkupPointer *pMarkupBegin = NULL;
				IMarkupPointer *pMarkupEnd = NULL;

				// These markup pointers indicate the insertion point.
				hr = pMarkupServices->CreateMarkupPointer(&pMarkupBegin);
				if (SUCCEEDED(hr))
					hr = pMarkupServices->CreateMarkupPointer(&pMarkupEnd);

				if (SUCCEEDED(hr) && pMarkupBegin && pMarkupEnd) {
					IMarkupContainer *pMarkupContainer = NULL;

					// Parse the string -- the markup container contains the parsed HTML.
					// Markup pointers are updated to point to begining and end of new container.
					hr = pMarkupServices->ParseString(bstrHtml, 0, &pMarkupContainer, pMarkupBegin, pMarkupEnd);
					if (SUCCEEDED(hr) && pMarkupContainer) {
						IHTMLDocument3 *pHtmlDoc = NULL;

						// Retrieve the document interface to the markup container.
						hr = pMarkupContainer->QueryInterface(IID_PPV_ARGS(&pHtmlDoc));
						if (SUCCEEDED(hr) && pHtmlDoc) {
							// Invoke the user-defined action for this new fragment.
							hr = pCallback(pHtmlDoc, message);

							// Clean up.
							pHtmlDoc->Release();
						}
						pMarkupContainer->Release();
					}
					pMarkupEnd->Release();
				}
				if (pMarkupBegin)
					pMarkupBegin->Release();
				pMarkupServices->Release();
			}
			pPersistStreamInit->Release();
		}
		pHtmlDocRoot->Release();
	}
	return hr;
}
コード例 #3
0
ファイル: play.cpp プロジェクト: adoggie/netbar_2006
void    TFormPlay::ShowHtml(char * html){
    IPersistStreamInit *psi;
    wb->Navigate(WideString("about:blank"));
    wb->Document->QueryInterface(IID_IPersistStreamInit,(void**)&psi);
    HGLOBAL  gdata;
    IStream *istream;
    gdata = GlobalAlloc(GPTR,strlen( html)+1);
    strcpy( (char*)gdata,html);
    CreateStreamOnHGlobal(gdata,TRUE,&istream);
    psi->InitNew();
    psi->Load(istream);
    //GlobalFree(gdata);
}
コード例 #4
0
ファイル: UIActiveX.cpp プロジェクト: fstudio/Phoenix
bool CActiveXUI::DelayedControlCreation()
{
   ReleaseControl();
   // At this point we'll create the ActiveX control
   m_bCreated = true;
   IOleControl* pOleControl = NULL;
   HRESULT Hr = ::CoCreateInstance(m_clsid, NULL, CLSCTX_ALL, IID_IOleControl, (LPVOID*) &pOleControl);
   ASSERT(SUCCEEDED(Hr));
   if( FAILED(Hr) ) return false;
   pOleControl->QueryInterface(IID_IOleObject, (LPVOID*) &m_pUnk);
   pOleControl->Release();
   if( m_pUnk == NULL ) return false;
   // Create the host too
   m_pControl = new CActiveXCtrl();
   m_pControl->m_pOwner = this;
   // More control creation stuff
   DWORD dwMiscStatus = 0;
   m_pUnk->GetMiscStatus(DVASPECT_CONTENT, &dwMiscStatus);
   IOleClientSite* pOleClientSite = NULL;
   m_pControl->QueryInterface(IID_IOleClientSite, (LPVOID*) &pOleClientSite);
   CSafeRelease<IOleClientSite> RefOleClientSite = pOleClientSite;
   // Initialize control
   if( (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST) != 0 ) m_pUnk->SetClientSite(pOleClientSite);
   IPersistStreamInit* pPersistStreamInit = NULL;
   m_pUnk->QueryInterface(IID_IPersistStreamInit, (LPVOID*) &pPersistStreamInit);
   if( pPersistStreamInit != NULL ) {
      Hr = pPersistStreamInit->InitNew();
      pPersistStreamInit->Release();
   }
   if( FAILED(Hr) ) return false;
   if( (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST) == 0 ) m_pUnk->SetClientSite(pOleClientSite);
   // Grab the view...
   Hr = m_pUnk->QueryInterface(IID_IViewObjectEx, (LPVOID*) &m_pControl->m_pViewObject);
   if( FAILED(Hr) ) Hr = m_pUnk->QueryInterface(IID_IViewObject2, (LPVOID*) &m_pControl->m_pViewObject);
   if( FAILED(Hr) ) Hr = m_pUnk->QueryInterface(IID_IViewObject, (LPVOID*) &m_pControl->m_pViewObject);
   // Activate and done...
   m_pUnk->SetHostNames(OLESTR("UIActiveX"), NULL);
   if( (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME) == 0 ) {
      Hr = m_pUnk->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, pOleClientSite, 0, m_pManager->GetPaintWindow(), &m_rcItem);
      ::RedrawWindow(m_pManager->GetPaintWindow(), &m_rcItem, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_INTERNALPAINT | RDW_FRAME);
   }
   IObjectWithSite* pSite = NULL;
   m_pUnk->QueryInterface(IID_IObjectWithSite, (LPVOID*) &pSite);
   if( pSite != NULL ) {
      pSite->SetSite(static_cast<IOleClientSite*>(m_pControl));
      pSite->Release();
   }
   return SUCCEEDED(Hr);
}
コード例 #5
0
// @pymethod |PyIPersistStreamInit|InitNew|Initializes the object to a default state.
PyObject *PyIPersistStreamInit::InitNew(PyObject *self, PyObject *args)
{
	if ( !PyArg_ParseTuple(args, ":InitNew") )
		return NULL;

	IPersistStreamInit *pIPSI = GetI(self);
	if ( pIPSI == NULL )
		return NULL;

	PY_INTERFACE_PRECALL;
	HRESULT hr = pIPSI->InitNew();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIPSI, IID_IPersistStreamInit);

	Py_INCREF(Py_None);
	return Py_None;
}
コード例 #6
0
//
// Function: LoadWebOCFromStream
//
// Description: Takes an IWebBrowser pointer and causes the stream to 
// be loaded into the contained HTML Document Object.
//
HRESULT LoadWebOCFromStream(IWebBrowser *pWebBrowser, IStream *pStream)
{
    HRESULT             hr;
    LPDISPATCH          pHtmlDoc = NULL;
    IPersistStreamInit *pPersistStreamInit = NULL;

    // Test for valid pointers.
    //
    if (!pWebBrowser || !pStream)
        return E_POINTER;

    // Get to the document object's IDispatch pointer.
    //
    hr = pWebBrowser->get_Document(&pHtmlDoc);
    if (hr)
        goto CleanUp;

    // Query for IPersistStreamInit
    //
    hr = pHtmlDoc->QueryInterface(IID_IPersistStreamInit, 
            (void**)&pPersistStreamInit);
    if (hr)
        goto CleanUp;

    // Tell the document we'll be reinitializing it.
    //
    hr = pPersistStreamInit->InitNew();
    if (hr)
        goto CleanUp;

    // Load the contents of the stream.
    //
    hr = pPersistStreamInit->Load(pStream);

CleanUp:
    if (pHtmlDoc)
        pHtmlDoc->Release();
    if (pPersistStreamInit)
        pPersistStreamInit->Release();
    return hr;

}
コード例 #7
0
void Win32WebControl::_loadHTMLString(const std::string &html) const
{
    bool flag = false;
    HGLOBAL htmlText = globalAllocWstringFromString(html);
    if (htmlText != NULL)
    {
        IStream *stream = NULL;
        if (SUCCEEDED(CreateStreamOnHGlobal(htmlText, FALSE, &stream)))
        {
            IPersistStreamInit *persistStreamInit = NULL;
            if (SUCCEEDED(_htmlDoc->QueryInterface(IID_IPersistStreamInit, (void **)&persistStreamInit)))
            {
                if (SUCCEEDED(persistStreamInit->InitNew()) && SUCCEEDED(persistStreamInit->Load(stream)))
                {
                    flag = true;
                }
                persistStreamInit->Release();
            }
            stream->Release();
        }
        GlobalFree(htmlText);
    }
    if (flag)
    {
        if (_didFinishLoading != nullptr)
        {
            std::string str("data:text/html,");
            str.append(html);
            _didFinishLoading(str);
        }
    }
    else
    {
        if (_didFailLoading != nullptr)
        {
            std::string str("data:text/html,");
            str.append(html);
            _didFailLoading(str);
        }
    }
}
コード例 #8
0
bool CActiveXUI::DoCreateControl()
{
    ReleaseControl();
    // At this point we'll create the ActiveX control
    m_bCreated = true;
    IOleControl* pOleControl = NULL;

    HRESULT Hr = -1;
    if( !m_sModuleName.IsEmpty() ) {
        HMODULE hModule = ::LoadLibrary((LPCTSTR)m_sModuleName);
        if( hModule != NULL ) {
            IClassFactory* aClassFactory = NULL;
            DllGetClassObjectFunc aDllGetClassObjectFunc = (DllGetClassObjectFunc)::GetProcAddress(hModule, "DllGetClassObject");
            Hr = aDllGetClassObjectFunc(m_clsid, IID_IClassFactory, (LPVOID*)&aClassFactory);
            if( SUCCEEDED(Hr) ) {
                Hr = aClassFactory->CreateInstance(NULL, IID_IOleObject, (LPVOID*)&pOleControl);
            }
            aClassFactory->Release();
        }
    }
    if( FAILED(Hr) ) {
        Hr = ::CoCreateInstance(m_clsid, NULL, CLSCTX_ALL, IID_IOleControl, (LPVOID*)&pOleControl);
    }
    ASSERT(SUCCEEDED(Hr));
    if( FAILED(Hr) ) return false;
    pOleControl->QueryInterface(IID_IOleObject, (LPVOID*) &m_pUnk);
    pOleControl->Release();
    if( m_pUnk == NULL ) return false;
    // Create the host too
    m_pControl = new CActiveXCtrl();
    m_pControl->m_pOwner = this;
    // More control creation stuff
    DWORD dwMiscStatus = 0;
    m_pUnk->GetMiscStatus(DVASPECT_CONTENT, &dwMiscStatus);
    IOleClientSite* pOleClientSite = NULL;
    m_pControl->QueryInterface(IID_IOleClientSite, (LPVOID*) &pOleClientSite);
    CSafeRelease<IOleClientSite> RefOleClientSite = pOleClientSite;
    // Initialize control
    if( (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST) != 0 ) m_pUnk->SetClientSite(pOleClientSite);
    IPersistStreamInit* pPersistStreamInit = NULL;
    m_pUnk->QueryInterface(IID_IPersistStreamInit, (LPVOID*) &pPersistStreamInit);
    if( pPersistStreamInit != NULL ) {
        Hr = pPersistStreamInit->InitNew();
        pPersistStreamInit->Release();
    }
    if( FAILED(Hr) ) return false;
    if( (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST) == 0 ) m_pUnk->SetClientSite(pOleClientSite);
    // Grab the view...
    Hr = m_pUnk->QueryInterface(IID_IViewObjectEx, (LPVOID*) &m_pControl->m_pViewObject);
    if( FAILED(Hr) ) Hr = m_pUnk->QueryInterface(IID_IViewObject2, (LPVOID*) &m_pControl->m_pViewObject);
    if( FAILED(Hr) ) Hr = m_pUnk->QueryInterface(IID_IViewObject, (LPVOID*) &m_pControl->m_pViewObject);
    // Activate and done...
    m_pUnk->SetHostNames(OLESTR("UIActiveX"), NULL);
    if( m_pManager != NULL ) m_pManager->SendNotify((CControlUI*)this, _T("showactivex"), 0, 0, false);
    if( (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME) == 0 ) {
        Hr = m_pUnk->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, pOleClientSite, 0, m_pManager->GetPaintWindow(), &m_rcItem);
        //::RedrawWindow(m_pManager->GetPaintWindow(), &m_rcItem, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_INTERNALPAINT | RDW_FRAME);
    }
    IObjectWithSite* pSite = NULL;
    m_pUnk->QueryInterface(IID_IObjectWithSite, (LPVOID*) &pSite);
    if( pSite != NULL ) {
        pSite->SetSite(static_cast<IOleClientSite*>(m_pControl));
        pSite->Release();
    }
    return SUCCEEDED(Hr);
}
コード例 #9
0
ファイル: AxWidget.cpp プロジェクト: fgokey/WidgetUI
bool AxContainer::CreateControl( const std::string &strModule, REFCLSID rclsid )
{
	IOleControl* pOleControl = NULL;

	HRESULT hr = -1;
	if( !strModule.empty() ) 
	{
		HMODULE hModule = ::LoadLibrary((LPCTSTR)strModule.c_str());
		if( hModule != NULL ) 
		{
			IClassFactory* aClassFactory = NULL;
			DllGetClassObjectFunc aDllGetClassObjectFunc = (DllGetClassObjectFunc)::GetProcAddress(hModule, "DllGetClassObject");
			hr = aDllGetClassObjectFunc(rclsid, IID_IClassFactory, (LPVOID*)&aClassFactory);
			if( SUCCEEDED(hr) ) 
			{
				hr = aClassFactory->CreateInstance(NULL, IID_IOleObject, (LPVOID*)&pOleControl);
			}
			aClassFactory->Release();
		}
	}
	if( FAILED(hr) ) 
		hr = ::CoCreateInstance(rclsid, NULL, CLSCTX_ALL, IID_IOleControl, (LPVOID*)&pOleControl);

	if( FAILED(hr) ) 
		return false;
	pOleControl->QueryInterface(IID_IOleObject, (LPVOID*) &m_pOleObject);
	pOleControl->Release();
	if( m_pOleObject == NULL ) 
		return false;

	hr = m_pOleObject->QueryInterface(IID_IOleInPlaceObjectWindowless, (LPVOID*) &m_pInPlaceObject);

	// More control creation stuff
	DWORD dwMiscStatus = 0;
	m_pOleObject->GetMiscStatus(DVASPECT_CONTENT, &dwMiscStatus);
	// Initialize control
	if( (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST) != 0 ) 
		m_pOleObject->SetClientSite(this);
	IPersistStreamInit* pPersistStreamInit = NULL;
	m_pOleObject->QueryInterface(IID_IPersistStreamInit, (LPVOID*) &pPersistStreamInit);
	if( pPersistStreamInit != NULL )
	{
		hr = pPersistStreamInit->InitNew();
		pPersistStreamInit->Release();
	}
	if( FAILED(hr) ) 
		return false;
	if( (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST) == 0 ) 
		m_pOleObject->SetClientSite(this);
	// Grab the view...
	hr = m_pOleObject->QueryInterface(IID_IViewObjectEx, (LPVOID*) &m_pViewObject);
	if( FAILED(hr) ) 
		hr = m_pOleObject->QueryInterface(IID_IViewObject2, (LPVOID*) &m_pViewObject);
	if( FAILED(hr) ) 
		hr = m_pOleObject->QueryInterface(IID_IViewObject, (LPVOID*) &m_pViewObject);

	// Activate and done...
	m_pOleObject->SetHostNames(OLESTR("UIActiveX"), NULL);
	if( (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME) == 0 ) 
		DoVerb(OLEIVERB_INPLACEACTIVATE);

	IObjectWithSite* pSite = NULL;
	m_pOleObject->QueryInterface(IID_IObjectWithSite, (LPVOID*) &pSite);
	if( pSite != NULL ) 
	{
		pSite->SetSite(static_cast<IOleWindow*>(this));
		pSite->Release();
	}

	return SUCCEEDED(hr);
}
コード例 #10
0
ファイル: SITE.CPP プロジェクト: 0anion0/IBN
/*
 * CSite::Load
 *
 * Purpose:
 *  Loads the path provided using IPersistMoniker or IPersistFile. If no path
 *	was provided it simply does an InitNew
 *
 * Parameters:
 *  pchPath - The path
 *
 * Return Value:
 */
HRESULT CSite::Load(LPCTSTR pchPath)
{
    HRESULT   hr = S_OK;

    if ( pchPath != NULL && *pchPath != 0)
    {
        USES_CONVERSION;
        LPWSTR szwName = T2W(const_cast<LPTSTR>(pchPath));

        // Path has been provided so check should we use IPersistMoniker or IPersistFile?
        if (memcmp(pchPath, _T("file:"), 5 * sizeof(TCHAR)) == 0 ||
                memcmp(pchPath, _T("http:"), 5 * sizeof(TCHAR)) == 0 ||
                memcmp(pchPath, _T("https:"), 5 * sizeof(TCHAR)) == 0)
        {
//		    OLECHAR  szwName[256];
//			MultiByteToWideChar(CP_ACP, 0, pchPath, -1, szwName, 256);

            // Ask the system for a URL Moniker
            IMoniker* pIMoniker;
            hr = CreateURLMoniker(NULL, (LPWSTR)szwName, &pIMoniker);
            if ( SUCCEEDED(hr) )
            {
                // Get the IPersistMoniker interface
                IPersistMoniker* pPMk;
                hr = m_pObj->QueryInterface(
                         IID_IPersistMoniker,
                         (void **)&pPMk);
                if ( SUCCEEDED(hr) )
                {

                    // note: do not register our BSC when calling IPM::Load directly
                    IBindCtx *pBCtx;
                    hr = CreateBindCtx(0, &pBCtx);
                    if ( SUCCEEDED(hr) )
                    {
                        // Call Load on the IPersistMoniker
                        hr = pPMk->Load(FALSE, pIMoniker, pBCtx, STGM_READ);

                        pBCtx->Release();
                    }
                    ReleaseInterface(pPMk);
                }
                ReleaseInterface( pIMoniker );
            }
        }
        else if ( m_pFR->IsFilterIn() )
        {
            IPersistStreamInit* pPStm = NULL;
            LPSTREAM pFilteredStream = NULL;
            DWORD dwFlags = 0;

//			dwFlags = ((CCEditApp*) AfxGetApp())->GetOptions().GetFilterFlags();
//			dwFlags |= dwFilterMultiByteStream; // loading an ANSI Stream

            hr = m_pObj->QueryInterface(
                     IID_IPersistStreamInit,
                     (void **)&pPStm);

            if ( SUCCEEDED(hr) )
            {
                if (SUCCEEDED(hr = HrFilterIn(pchPath, &pFilteredStream, dwFlags)))
                {
                    hr = pPStm->Load(pFilteredStream);

                    ReleaseInterface(pFilteredStream);
                    ReleaseInterface(pPStm);
                }
            }
        }
        else
        {
//		    OLECHAR  szwName[256];
//			MultiByteToWideChar(CP_ACP, 0, pchPath, -1, szwName, 256);
            IPersistFile*  pPFile;
            hr = m_pObj->QueryInterface(
                     IID_IPersistFile,
                     (void **) &pPFile);
            if ( SUCCEEDED(hr) )
            {
                // Call Load on the IPersistFile
                hr = pPFile->Load((LPWSTR)szwName, 0);
                ReleaseInterface(pPFile);
            }
        }
    }
    else
    {
        // No path provided so just do an InitNew on the Stream
        IPersistStreamInit* pPStm;
        hr = m_pObj->QueryInterface(
                 IID_IPersistStreamInit,
                 (void **)&pPStm);
        if ( SUCCEEDED(hr) )
        {
            hr = pPStm->InitNew();
            ReleaseInterface(pPStm);
        }
    }

    return hr;
}
コード例 #11
0
ファイル: IEHtmlWin.cpp プロジェクト: Aegisub/traydict
void IEHtmlWin::CreateBrowser()
{
	SetTransparent(255);

	HRESULT hret;

	IUnknown *p;			
	// Get IUnknown Interface
	hret = CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_ALL, IID_IUnknown, (void**)(&p));
	wxASSERT(SUCCEEDED(hret));

	// Get IOleObject interface
	hret = p->QueryInterface(IID_IViewObject, (void**)(&m_viewObject));
	wxASSERT(SUCCEEDED(hret));
	hret = p->QueryInterface(IID_IOleObject, (void**)(&m_oleObject));
	wxASSERT(SUCCEEDED(hret));

	FrameSite * c = new FrameSite(this);
	c->AddRef();

	DWORD dwMiscStatus;
	m_oleObject->GetMiscStatus(DVASPECT_CONTENT, &dwMiscStatus);
	bool m_bSetClientSiteFirst = false;
	if (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST)
	{
		m_bSetClientSiteFirst = true;
	}
	bool m_bVisibleAtRuntime = true;
	if (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME)
	{
		m_bVisibleAtRuntime = false;
	}

	if (m_bSetClientSiteFirst) m_oleObject->SetClientSite(c->m_IOleClientSite);

	IPersistStreamInit * psInit = NULL;
	hret = p->QueryInterface(IID_IPersistStreamInit, (void**)(&psInit));
	if (SUCCEEDED(hret) && psInit != NULL) {
		hret = psInit->InitNew();
		wxASSERT(SUCCEEDED(hret));
	}

	// Get IOleInPlaceObject interface
	hret = p->QueryInterface(IID_IOleInPlaceObject, (void**)(&m_oleInPlaceObject));
	assert(SUCCEEDED(hret));

	hret = m_oleInPlaceObject->GetWindow(&m_oleObjectHWND);
	wxASSERT(SUCCEEDED(hret));

	::SetActiveWindow(m_oleObjectHWND);
	
	int w, h;
	GetSize(&w, &h);
	RECT posRect;
	posRect.left = 0;
	posRect.top = 0;
	posRect.right = w;
	posRect.bottom = h;
	
	m_oleInPlaceObject->SetObjectRects(&posRect, &posRect);

	if (m_bVisibleAtRuntime) {
		hret = m_oleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, 
			c->m_IOleClientSite, 0, (HWND)GetHWND(), &posRect);
	}
	
	if (!m_bSetClientSiteFirst) m_oleObject->SetClientSite(c->m_IOleClientSite);

	// Get IWebBrowser2 Interface
	hret = p->QueryInterface(IID_IWebBrowser2, (void**)(&m_webBrowser));
	assert(SUCCEEDED(hret));

	IConnectionPointContainer * cpContainer;
	hret = p->QueryInterface(IID_IConnectionPointContainer, (void**)(&cpContainer));
	assert(SUCCEEDED(hret));
	hret = cpContainer->FindConnectionPoint(DIID_DWebBrowserEvents2, &m_connectionPoint);
	assert(SUCCEEDED(hret));
	m_connectionPoint->Advise(c->m_DWebBrowserEvents2, &m_adviseCookie);
	cpContainer->Release();

	p->Release();

	m_webBrowser->put_MenuBar(VARIANT_FALSE);
	m_webBrowser->put_AddressBar(VARIANT_FALSE);
	m_webBrowser->put_StatusBar(VARIANT_FALSE);
	m_webBrowser->put_ToolBar(VARIANT_FALSE);

	m_webBrowser->put_RegisterAsBrowser(VARIANT_TRUE);
	m_webBrowser->put_RegisterAsDropTarget(VARIANT_TRUE);
}