コード例 #1
1
HRESULT vmsDomHelper::GetParentDocument(IHTMLDocument2 *pDoc, IHTMLDocument2 **ppParentDoc)
{
	*ppParentDoc = NULL;

	ATLASSERT (pDoc != NULL);
	if (!pDoc)
		return E_INVALIDARG;

	IHTMLWindow2Ptr spWnd;
	HRESULT hr = pDoc->get_parentWindow (&spWnd);
	if (FAILED (hr))
		return hr;

	IHTMLWindow2Ptr spWndParent;
	hr = spWnd->get_parent (&spWndParent);
	if (FAILED (hr))
		return hr;

	hr = spWndParent->get_document (ppParentDoc);
	if (hr == E_ACCESSDENIED)
	{
		IWebBrowser2Ptr spWB;
		hr = GetWebBrowser (spWndParent, &spWB);
		if (FAILED (hr))
			return E_ACCESSDENIED;
		IDispatchPtr spdDoc;
		hr = spWB->get_Document (&spdDoc);
		if (FAILED (hr))
			return hr;
		hr = spdDoc->QueryInterface (IID_IHTMLDocument2, (void**)ppParentDoc);
	}
	if (FAILED (hr))
		return hr;

	IUnknownPtr spUnk1 (pDoc);
	IUnknownPtr spUnk2 (*ppParentDoc);
	if (pDoc == *ppParentDoc || spUnk1 == spUnk2)
	{
		(*ppParentDoc)->Release ();
		*ppParentDoc = NULL;
	}

	return S_OK;
}
コード例 #2
0
ファイル: vmsflashhelper.cpp プロジェクト: pedia/raidget
void vmsFlashHelper::GetFlashMoviesObjList(IHTMLDocument2Ptr spDoc, LPFLASHLIST pv, BOOL bIncludingFrames)
{
	
    GetFlashMoviesObjList_noframes (spDoc, pv);

	if (bIncludingFrames == FALSE)
		return;

    
    IHTMLFramesCollection2Ptr spFrames;
	spDoc->get_frames (&spFrames);
	if (spFrames == NULL)
		return;

	long lCount = 0;
	spFrames->get_length (&lCount);

	for (long i = 0; i < lCount; i++)
	{
		CComVariant va ((long)i);
		CComVariant vaR;

		spFrames->item (&va, &vaR);

		if (vaR.pdispVal != NULL)
		{
			IHTMLWindow2Ptr spWnd = vaR.pdispVal;
			if (spWnd != NULL)
			{
				IHTMLDocument2Ptr spFDoc;
				spWnd->get_document (&spFDoc);
				if (spFDoc != NULL)
					GetFlashMoviesObjList (spFDoc, pv, TRUE);
			}
		}
	}
}
コード例 #3
0
ファイル: vmsflashhelper.cpp プロジェクト: pedia/raidget
void vmsFlashHelper::SaveFlashMovies(IHTMLDocument2Ptr spDoc, LPCSTR pszFolder, BOOL bIncludingFrames)
{
    SaveFlashMovies_noframes(spDoc, pszFolder);

	if (bIncludingFrames == FALSE)
		return;

    
    IHTMLFramesCollection2Ptr spFrames;
	spDoc->get_frames (&spFrames);
	if (spFrames == NULL)
		return;

	long lCount = 0;
	spFrames->get_length (&lCount);

	for (long i = 0; i < lCount; i++)
	{
		CComVariant va ((long)i);
		CComVariant vaR;

		spFrames->item (&va, &vaR);

		if (vaR.pdispVal != NULL)
		{
			IHTMLWindow2Ptr spWnd = vaR.pdispVal;
			if (spWnd != NULL)
			{
				IHTMLDocument2Ptr spFDoc;
				spWnd->get_document (&spFDoc);
				if (spFDoc != NULL)
					SaveFlashMovies (spFDoc, pszFolder, TRUE);
			}
		}
	}
}