IFrame Problem

Discussion in 'Programming' started by harish_dixit1, Jun 26, 2006.

  1. #1
    Hello friends,

    in web page www.adwords.com there is IFrame.
    i want to get controls/elements of this IFrame.
    How can i do that. This is my VC++ code:

    i written code::::

    here g_lpHTMLDocument2 is IHTMLDocument2 pointer .
    It contains valid document pointer.

    IHTMLFramesCollection2Ptr pFrameColl;
    hr = g_lpHTMLDocument2->get_frames(&pFrameColl);
    if(SUCCEEDED(hr))
    {
    IDispatch *pDisp = NULL;
    long lFrames = 0;
    pFrameColl->get_length(&lFrames);
    for ( long i = 0; i < lFrames ; i++ )
    {
    VARIANT varIndex, varDispatch;
    VariantInit(&varIndex);
    VariantInit(&varDispatch);
    varIndex.vt = VT_I4;
    varIndex.lVal = i;
    if(SUCCEEDED(pFrameColl->item(&varIndex, &varDispatch)))
    {
    if(varDispatch.vt == VT_DISPATCH)
    {
    CComPtr pHTMLWnd2;
    if(SUCCEEDED(hr = varDispatch.pdispVal->QueryInterface(IID_IHTMLWindow2,(LPVOID*)&pHTMLWnd2)))
    {
    IHTMLDocument2Ptr pHTMLDoc2;
    hr = pHTMLWnd2->get_document(&pHTMLDoc2);
    //HERE I M GETTING NULL PONTER ,ERROR IS ACCESS DENIED

    IHTMLElementCollection* pElementColl = NULL;
    pHTMLDoc2->get_all(&pElementColl);

    }

    pHTMLDoc2 DOES NOT CONTAIN VALID ADDRESS.

    Can someone help

    Harry
     
    harish_dixit1, Jun 26, 2006 IP