I want to know:
(a) under what circumstances does one get the Access Denied error and how
does one prevent it?
(b) if there exists a better way to walk through the form elements using the
DOM? If yes, kindly enligthen me.
HRESULT GetHTMLContent (IHTMLDocument2 *spHTML)
{
HRESULT hr;
CComPtr<IHTMLElementCollection> pForms; // Process the
forms
hr = spHTML->get_forms(&pForms);
if (FAILED(hr))
return hr;
ProcessForms (pForms);
CComPtr<IHTMLFramesCollection2> pFrames; // Process the Frames
hr = spHTML->get_frames(&pFrames);
if (FAILED(hr))
return hr;
ProcessFrames (pFrames);
return S_OK;
}
HRESULT ProcessFrames (IHTMLFramesCollection2 *pCollect)
{
HRESULT hr;
long l;
VARIANT v1, v2;
hr = pCollect->get_length (&l);
if (FAILED (hr))
return hr;
for (int i = 0; i < l; i++) {
// "-------Processing Frame %d out of %d
--------------- ", i+1, l
v1.vt = VT_I4; v1.lVal = i;
VariantClear (&v2);
hr = pCollect->item (&v1, &v2);
if (FAILED(hr))
return hr;
if (v2.vt == VT_DISPATCH) {
CComPtr<IDispatch> pDispatch;
pDispatch = v2.pdispVal;
CComQIPtr<IHTMLWindow2, &IID_IHTMLWindow2> pFrame;
pFrame = pDispatch;
if (pFrame) {
CComPtr<IHTMLDocument2> spHTML;
hr = pFrame->get_document (&spHTML);
if (FAILED(hr)) {
// This is the place where it FAILS
return hr;
}
GetHTMLContent (spHTML);
}
}
}
return S_OK;
}
Hi,
The Microsoft KB 196340 article shoudl answer your problem :
http://support.microsoft.com/kb/196340/en-us
Hope this helps.
--
Regards / Cordialement
====================
Jean-Fabrice Rabaute
CORE SERVICES :: Software/Web development & Consulting services
http://www.debugbar.com : The most advanced WEB development tool for
Internet Explorer
http://www.core-services.fr - {Enjoy the future today}
Hi,
Hi,