IHTMLCollection iterating through HTML frames / GUI manipulation


LRESULT lResult;
UINT nMsg = ::RegisterWindowMessage( _T("WM_HTML_GETOBJECT") );
::SendMessageTimeout( handleToInternetExplorerWindow, nMsg, 0L, 0L, SMTO_ABORTIFHUNG, 1000, (DWORD*)&lResult);
LPFNOBJECTFROMLRESULT pfObjectFromLresult = (LPFNOBJECTFROMLRESULT)::GetProcAddress( hInst, "ObjectFromLresult" );
HRESULT hr;
CComPtr htmlDoc2;
hr = (*pfObjectFromLresult)( lRes, IID_IHTMLDocument2, 0, (void**)&htmlDoc2);
if ( SUCCEEDED(hr) )
{
        IHTMLFramesCollection2 *p;
	htmlDoc2->get_frames(&p);
	long lLen;
        p->get_length(&lLen);
	for (long i = 0; i < lLen; i++)
	{
            // iterate through the frames
        }
}

Leave a Reply

Your email address will not be published. Required fields are marked *