IcWang
October 31st, 1999, 09:44 AM
hi:
I want to access the web page document data within frameset windows.
In general, we can use IWebBrowser2->get_Document to access the page context,
but if this page is in the frameset window,how can I make it accessible??
ex: <frameset>
<frame src="" name=A>
<frame src="" name=B>
</frameset>
I just want to get merely the document data in window B, how to make it??
when using IHTMLFramesCollection2,I found some problems:
CComPtr<IDispatch> pDisp;
CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spHTML2;
HRESULT hr1 = m_pBrowserApp->get_Document(&pDisp);
spHTML2 = pDisp;
IHTMLFramesCollection2 *spFrame;
hr1 = spHTML2->get_frames( &spFrame );
if(SUCCEEDED(hr1))
{ long len;
spFrame->get_length(&len);
for(int i=0;i<len;i++)
{ VARIANT pvarIndex;
pvarIndex.vt = VT_UINT;
pvarIndex.lVal =i;
VARIANT pvarResult;
VariantInit(&pvarResult);
hr1 =spFrame->item( &pvarIndex, &pvarResult);
if(hr1 == S_OK)
{
IHTMLElement* pHTMLElement;
hr1=(pvarResult.pdispVal)->QueryInterface(IID_IHTMLElement, (void**)&pHTMLElement);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I failed in above code,WHAT's the problem with it??
your answer will be appreciated!!
I want to access the web page document data within frameset windows.
In general, we can use IWebBrowser2->get_Document to access the page context,
but if this page is in the frameset window,how can I make it accessible??
ex: <frameset>
<frame src="" name=A>
<frame src="" name=B>
</frameset>
I just want to get merely the document data in window B, how to make it??
when using IHTMLFramesCollection2,I found some problems:
CComPtr<IDispatch> pDisp;
CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spHTML2;
HRESULT hr1 = m_pBrowserApp->get_Document(&pDisp);
spHTML2 = pDisp;
IHTMLFramesCollection2 *spFrame;
hr1 = spHTML2->get_frames( &spFrame );
if(SUCCEEDED(hr1))
{ long len;
spFrame->get_length(&len);
for(int i=0;i<len;i++)
{ VARIANT pvarIndex;
pvarIndex.vt = VT_UINT;
pvarIndex.lVal =i;
VARIANT pvarResult;
VariantInit(&pvarResult);
hr1 =spFrame->item( &pvarIndex, &pvarResult);
if(hr1 == S_OK)
{
IHTMLElement* pHTMLElement;
hr1=(pvarResult.pdispVal)->QueryInterface(IID_IHTMLElement, (void**)&pHTMLElement);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I failed in above code,WHAT's the problem with it??
your answer will be appreciated!!