Example #1
0
HRESULT CBrowser::GetWebBrowser(IWebBrowser2** ppWebBrowser)
{
	if (NULL == ppWebBrowser)
	{
		traceLog << "ppWebBrowser parameter is NULL in Browser::GetWebBrowser\n";
		return E_INVALIDARG;
	}

	if (m_spPlugin == NULL)
	{
		traceLog << "m_spPlugin is NULL in CBrowser::GetWebBrowser\n";
		return E_UNEXPECTED;
	}

	CComQIPtr<IWebBrowser2> spBrws;
	HRESULT hRes = m_spPlugin->GetNativeBrowser(&spBrws);
	if (spBrws == NULL)
	{
		traceLog << "m_spPlugin->GetNativeBrowser failed with code " << hRes << "in CBrowser::GetWebBrowser\n";
		return hRes;
	}

	*ppWebBrowser = spBrws.Detach();
	return S_OK;
}
Example #2
0
STDMETHODIMP CBrowser::get_core(ICore** pVal)
{
	// Reset the lastError property.
	SetLastErrorCode(ERR_OK);

	if (NULL == pVal)
	{
		traceLog << "pVal is NULL in CBrowser::get_core\n";
		SetComErrorMessage(IDS_PROPERTY_FAILED, CORE_PROPERTY, IDH_BROWSER_CORE);
		SetLastErrorCode(ERR_INVALID_ARG);
		return HRES_INVALID_ARG;	
	}

	if (m_spCore == NULL)
	{
		traceLog << "m_spCore is NULL in CBrowser::get_core\n";
		SetComErrorMessage(IDS_PROPERTY_FAILED, CORE_PROPERTY, IDH_BROWSER_CORE);
		SetLastErrorCode(ERR_FAIL);
		return HRES_FAIL;	
	}

	CComQIPtr<ICore> spCore = m_spCore;
	*pVal = spCore.Detach();

	return HRES_OK;
}
Example #3
0
bool CXmlDocument::TransformNodeToObject(CXmlDocument*pNode,CXmlDocument*pOutDOM)
{
	XmlDocument pXmlDoc;

	HRESULT hr = pXmlDoc.CreateInstance(__uuidof(MSXML2::DOMDocument));
	if ( hr == S_OK )
	{
		CComQIPtr<IDispatch> pDisp = pXmlDoc;
		if ( !pDisp ) return false;

		CComVariant vOut;
		vOut.vt = VT_DISPATCH;
		vOut.pdispVal = pDisp.Detach();
		hr = m_pDoc->transformNodeToObject(pNode->m_pDoc,vOut);
		if ( hr == S_OK )
		{
			bool bLogin=false;
			hr = pOutDOM->SetXmlDocument(&vOut,bLogin);

			return true;
		}
	}

	return false;

}
Example #4
0
STDMETHODIMP CLHTMLWindow::get_svgDocument(/*[out, retval]*/ ILSVGDocument* *pVal)
{
	ATLASSERT(pVal != NULL);
	if (pVal == NULL) return E_POINTER;
	CComQIPtr<ILSVGDocument> svgDocument = /*m_pView->*/m_document;
	*pVal = svgDocument.Detach();
	return S_OK;
}
HWND CIGMainWindow::getHWNDfromOLE (IDispatch* pDisp)
{
	CComQIPtr <IOleWindow> spWindow (pDisp);
	if (!spWindow)
		return false;
	HWND hWndHistory;
	spWindow->GetWindow (&hWndHistory);
	spWindow.Detach();
	return hWndHistory;
}
Example #6
0
STDMETHODIMP CStrokeDlg::handleActivateObjectEvent(IUnknown* object, long* cookie)
{
	CComQIPtr<IPDStrokeSettings> stroke = object;
	if (stroke)
	{
		m_targetObjects.Add(stroke.Detach());

		*cookie = m_targetObjects.GetSize();

		SetControlValues();
	}

	return S_OK;
}
bool GetAnchorFromElement(IHTMLElement *pElement, IHTMLAnchorElement **ppAnchorElement)
{
	CComPtr<IHTMLElement> spHTMLSrcTemp = pElement;
	CComQIPtr<IHTMLAnchorElement> spHTMLAnchor = pElement;
	while (!spHTMLAnchor && spHTMLSrcTemp)
	{
		CComPtr<IHTMLElement> spParentElement;
		if (FAILED(spHTMLSrcTemp->get_parentElement(&spParentElement)))
			break;
		spHTMLAnchor = spParentElement;
		spHTMLSrcTemp = spParentElement;
	}
	*ppAnchorElement = spHTMLAnchor.Detach();
	return *ppAnchorElement != NULL;
}
Example #8
0
static bool GetFilterGraph(IFilterGraph** ppFG)
{
	if(!ppFG) return(false);

    CComPtr<IRunningObjectTable> pROT;
    if(FAILED(GetRunningObjectTable(0, &pROT)))
		return 1;

	CComPtr<IEnumMoniker> pEM;
	if(FAILED(pROT->EnumRunning(&pEM)))
		return 1;

	CComPtr<IBindCtx> pBindCtx;
	CreateBindCtx(0, &pBindCtx);

	for(CComPtr<IMoniker> pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL)
	{
		LPOLESTR pDispName = NULL;
		if(FAILED(pMoniker->GetDisplayName(pBindCtx, NULL, &pDispName)))
			continue;

		CStringW strw(pDispName);
		
		CComPtr<IMalloc> pMalloc;
		if(FAILED(CoGetMalloc(1, &pMalloc)))
			continue;
		pMalloc->Free(pDispName);

		if(strw.Find(L"(MPC)") < 0)
			continue;

		CComPtr<IUnknown> pUnk;
		if(S_OK != pROT->GetObject(pMoniker, &pUnk))
			continue;

		CComQIPtr<IFilterGraph> pFG = pUnk;
		if(!pFG)
			continue;

		*ppFG = pFG.Detach();

		break;
	}

	return(!!*ppFG);
}
Example #9
0
STDMETHODIMP CWebSite::ShowViews()
{
	CComQIPtr<IWebEditorFrame> frame;
	gApp->get_frame(&frame);

	CComQIPtr<IUIContextManager> uiManager;
	gApp->get_uiManager(&uiManager);

	{
		CComQIPtr<IUIMDIChild> child;
		child.CoCreateInstance(CLSID_UIMDIChild);

		// Files
		{
			CComQIPtr<ISiteFilesView> filesView;
			filesView.CoCreateInstance(CLSID_SiteFilesView);
			filesView->Create(uiManager, L"Files", (IID*)&CLSID_SiteFilesView, NULL);
			filesView->put_webSiteDocument(this);
			child->AddView(filesView, NULL);
		}

		// Links
		{
			CComQIPtr<ISiteLinksView> linksView;
			linksView.CoCreateInstance(CLSID_SiteLinksView);
			linksView->Create(uiManager, L"Links", (IID*)&CLSID_SiteFilesView, NULL);
			linksView->put_document(this);
			child->AddView(linksView, NULL);
		}

		// FTP
		{
			CComQIPtr<ISiteFTPView> ftpView;
			ftpView.CoCreateInstance(CLSID_SiteFTPView);
			ftpView->Create(uiManager, L"FTP", (IID*)&CLSID_SiteFilesView, NULL);
			ftpView->put_document(this);
			child->AddView(ftpView, NULL);
		}

		child->CreateMDIChild(frame, NULL);
		child.Detach();	// Keep it open
	}

	return S_OK;
}
Example #10
0
void CIGMultiFrame::addFrame (IIGFrame *pFrame)
{
	if (m_spToolBox)
		pFrame->SetToolBox (m_spToolBox);

	CComQIPtr <IOleObject> spMultiFrameOleObject (this);
	CComPtr <IOleClientSite> spOleClientSite;
	spMultiFrameOleObject->GetClientSite (&spOleClientSite);

	CComQIPtr <IOleObject> spFrameOleObject (pFrame);
	spFrameOleObject->SetClientSite (spOleClientSite);	
	spFrameOleObject.Detach();

	if (pFrame && !frameExists (pFrame) && m_nNbFrames < IGFRAMES_MAX)
	{		
		m_ppFrames [m_nNbFrames++] = pFrame;
	}
	autoArrange();
}
Example #11
0
HRESULT IISxpressAPI::ResponseHistory::GetHTTPRequest(IIISxpressHTTPRequest** ppHTTPRequest)
{
	if (ppHTTPRequest == NULL)
		return E_POINTER;

	// get the active HTTPRequestUnk interface
	CComPtr<IUnknown> pHTTPRequestUnk;
	HRESULT hr = ::GetActiveObject(CLSID_IISxpressHTTPRequest, NULL, (IUnknown**) &pHTTPRequestUnk);
	if (hr != S_OK)
	{
		return hr;	
	}

	// get the active HTTPRequest interface
	CComQIPtr<IIISxpressHTTPRequest> pHTTPRequest = pHTTPRequestUnk;
	if (pHTTPRequest == NULL)
	{
		return E_FAIL;
	}

	*ppHTTPRequest = pHTTPRequest.Detach();

	return hr;
}
Example #12
0
STDMETHODIMP CVMR9AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
{
    CheckPointer(ppRenderer, E_POINTER);
    *ppRenderer = nullptr;

    CMacrovisionKicker* pMK = DEBUG_NEW CMacrovisionKicker(NAME("CMacrovisionKicker"), nullptr);
    CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)pMK;

    COuterVMR9* pOuter = DEBUG_NEW COuterVMR9(NAME("COuterVMR9"), pUnk, &m_VMR9AlphaBitmap, this);

    pMK->SetInner((IUnknown*)(INonDelegatingUnknown*)pOuter);
    CComQIPtr<IBaseFilter> pBF = pUnk;

    CComPtr<IPin> pPin = GetFirstPin(pBF);
    CComQIPtr<IMemInputPin> pMemInputPin = pPin;
    m_fUseInternalTimer = HookNewSegmentAndReceive((IPinC*)(IPin*)pPin, (IMemInputPinC*)(IMemInputPin*)pMemInputPin);

    if (CComQIPtr<IAMVideoAccelerator> pAMVA = pPin) {
        HookAMVideoAccelerator((IAMVideoAcceleratorC*)(IAMVideoAccelerator*)pAMVA);
    }

    CComQIPtr<IVMRFilterConfig9> pConfig = pBF;
    if (!pConfig) {
        return E_FAIL;
    }

    const CRenderersSettings& r = GetRenderersSettings();

    if (r.fVMR9MixerMode) {
        if (FAILED(pConfig->SetNumberOfStreams(1))) {
            return E_FAIL;
        }

        if (CComQIPtr<IVMRMixerControl9> pMC = pBF) {
            DWORD dwPrefs;
            pMC->GetMixingPrefs(&dwPrefs);

            // See http://msdn.microsoft.com/en-us/library/dd390928(VS.85).aspx
            dwPrefs |= MixerPref9_NonSquareMixing;
            dwPrefs |= MixerPref9_NoDecimation;
            if (r.fVMR9MixerYUV && !SysVersion::IsVistaOrLater()) {
                dwPrefs &= ~MixerPref9_RenderTargetMask;
                dwPrefs |= MixerPref9_RenderTargetYUV;
            }
            pMC->SetMixingPrefs(dwPrefs);
        }
    }

    if (FAILED(pConfig->SetRenderingMode(VMR9Mode_Renderless))) {
        return E_FAIL;
    }

    CComQIPtr<IVMRSurfaceAllocatorNotify9> pSAN = pBF;
    if (!pSAN) {
        return E_FAIL;
    }

    if (FAILED(pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast<IVMRSurfaceAllocator9*>(this)))
            || FAILED(AdviseNotify(pSAN))) {
        return E_FAIL;
    }

    *ppRenderer = (IUnknown*)pBF.Detach();

    return S_OK;
}
Example #13
0
HRESULT DXGIOutputDuplication::AcquireNextFrame(IDXGISurface1** pDXGISurface, DXGIPointerInfo*& pDXGIPointer)
{
	DXGI_OUTDUPL_FRAME_INFO fi;
	CComPtr<IDXGIResource> spDXGIResource;
	HRESULT hr = m_DXGIOutputDuplication->AcquireNextFrame(20, &fi, &spDXGIResource);
	if(FAILED(hr))
	{
		__L_INFO("m_DXGIOutputDuplication->AcquireNextFrame failed with hr=0x%08x", hr);
		return hr;
	}

	CComQIPtr<ID3D11Texture2D> spTextureResource = spDXGIResource;

	D3D11_TEXTURE2D_DESC desc;
	spTextureResource->GetDesc(&desc);

	D3D11_TEXTURE2D_DESC texDesc;
	ZeroMemory( &texDesc, sizeof(texDesc) );
	texDesc.Width = desc.Width;
	texDesc.Height = desc.Height;
	texDesc.MipLevels = 1;
	texDesc.ArraySize = 1;
	texDesc.SampleDesc.Count = 1;
	texDesc.SampleDesc.Quality = 0;
	texDesc.Usage = D3D11_USAGE_STAGING;
	texDesc.Format = desc.Format;
	texDesc.BindFlags = 0;
	texDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
	texDesc.MiscFlags = 0;

	CComPtr<ID3D11Texture2D> spD3D11Texture2D = NULL;
	hr = m_D3DDevice->CreateTexture2D(&texDesc, NULL, &spD3D11Texture2D);
	if(FAILED(hr))
		return hr;

	m_D3DDeviceContext->CopyResource(spD3D11Texture2D, spTextureResource);

	CComQIPtr<IDXGISurface1> spDXGISurface = spD3D11Texture2D;

	*pDXGISurface = spDXGISurface.Detach();
	
	// Updating mouse pointer, if visible
	if(fi.PointerPosition.Visible)
	{
		BYTE* pPointerShape = new BYTE[fi.PointerShapeBufferSize];

		DXGI_OUTDUPL_POINTER_SHAPE_INFO psi = {};
		UINT uiPointerShapeBufSize = fi.PointerShapeBufferSize;
		hr = m_DXGIOutputDuplication->GetFramePointerShape(uiPointerShapeBufSize, pPointerShape, &uiPointerShapeBufSize, &psi);
		if(hr == DXGI_ERROR_MORE_DATA)
		{
			pPointerShape = new BYTE[uiPointerShapeBufSize];
	
			hr = m_DXGIOutputDuplication->GetFramePointerShape(uiPointerShapeBufSize, pPointerShape, &uiPointerShapeBufSize, &psi);
		}

		if(hr == S_OK)
		{
			__L_INFO("PointerPosition Visible=%d x=%d y=%d w=%d h=%d type=%d\n", fi.PointerPosition.Visible, fi.PointerPosition.Position.x, fi.PointerPosition.Position.y, psi.Width, psi.Height, psi.Type);

			if((psi.Type == DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MONOCHROME ||
			    psi.Type == DXGI_OUTDUPL_POINTER_SHAPE_TYPE_COLOR ||
			    psi.Type == DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MASKED_COLOR) &&
				psi.Width <= 128 && psi.Height <= 128)
			{
				// Here we can obtain pointer shape
				if(pDXGIPointer)
				{
					delete pDXGIPointer;
				}

				pDXGIPointer = new DXGIPointerInfo(pPointerShape, uiPointerShapeBufSize, fi, psi);
				
				pPointerShape = NULL;
			}

			DXGI_OUTPUT_DESC outDesc;
			GetDesc(outDesc);

			if(pDXGIPointer)
			{
				pDXGIPointer->GetFrameInfo().PointerPosition.Position.x = outDesc.DesktopCoordinates.left + fi.PointerPosition.Position.x;
				pDXGIPointer->GetFrameInfo().PointerPosition.Position.y = outDesc.DesktopCoordinates.top + fi.PointerPosition.Position.y;
			}
		}

		if(pPointerShape)
		{
			delete [] pPointerShape;
		}
	}

	return hr;
}
Example #14
0
void SMILSeqElement::seekElement(double seekTo)
{
	m_timeContainerImpl->Seek(seekTo/1000);

	/*
	m_activeTime = seekTo/1000;

	CComPtr<ILDOMNode> node;
	get_firstChild(&node);
	while (node)
	{
		CComQIPtr<ILElementTime> elementTime = node;
		if (elementTime)
		{
			elementTime->seekElement(seekTo);
		}

		CComPtr<ILDOMNode> nextSibling;
		node->get_nextSibling(&nextSibling);
		node = nextSibling;
	}
	*/

// TODO sequential
#if 0

	m_activeChildren->m_items.RemoveAll();

	m_activeTime = seekTo;

	if (m_documentElement)
	{
		CComPtr<ILDOMElement> body = FindByTagName(m_documentElement, L"body", FALSE);
		if (body)
		{
			// TODO, call body->seekElement ?

			CComPtr<ILDOMNode> node;
			body->get_firstChild(&node);
			while (node)
			{
				CComQIPtr<ILElementTime> elementTime = node;
				if (elementTime)
				{
					elementTime->seekElement(seekTo);
				}

				CComQIPtr<ILSMILMediaElement> mediaElement = node;
				if (mediaElement)
				{
					m_activeChildren->m_items.Add(mediaElement.Detach());
				}

				CComPtr<ILDOMNode> nextSibling;
				node->get_nextSibling(&nextSibling);
				node = nextSibling;
			}
		}
		else
			ASSERT(0);	// TODO remove

		{
		// TODO, fix up here
			CLSMILDocument* pDocument = this;//((CLDOMDocument*)m_ownerDocument);

			for (int n = 0; n < pDocument->m_pElements.GetSize(); n++)
			{
#if 0
				pDocument->m_pElements[n]->Flow();
#endif

				if (pDocument->m_pElements[n]->m_pUI)
				{
					pDocument->m_pElements[n]->m_pUI->InvalidateRect(
						&pDocument->m_pElements[n]->m_client, FALSE);
				}
			}
		}
	}
#endif
}
Example #15
0
IDispatch* WizardApp::GetWebBrowserDisp()
{
	CComQIPtr<IDispatch> spDisp = m_spWebDisp;

	return spDisp.Detach();
}