首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

获取frames的有关问题

2012-02-08 
获取frames的问题IHTMLDocument2*pHTMLDocNULLIHTMLFramesCollection2*pFramesLPDISPATCHpDispVARIANT

获取frames的问题
IHTMLDocument2   *pHTMLDoc=NULL;
IHTMLFramesCollection2   *pFrames;
LPDISPATCH   pDisp;
VARIANT   id,index;
pDisp=mycwb-> Document;
if(pDisp)
      {
      }
else
      {
                ShowMessage( "Document   read   error. ");
                return;

      }
  if(SUCCEEDED(pDisp-> QueryInterface(IID_IHTMLDocument2,(void   **)&pHTMLDoc)))
              {
              }
  else
                {return;}
//pDisp-> Release();
IHTMLElementCollection   *pelement;
if(pHTMLDoc-> get_forms(&pelement)!=S_OK)   //得到form指针
                    {
                                pHTMLDoc-> Release();
                                pDisp-> Release();
                                pelement-> Release();
                                ShowMessage( "read   form   failed! ");
                                return;
                    }
long   p;
pelement-> get_length(&p);                     //form的个数
ShowMessage( "   Forms:   "+IntToStr(p));
if(p> 0)
        {
                    for   (long   i=0;i <p;i++)
                    {
                          V_VT(&id)=VT_I4;
                          V_I4(&id)=i;
                          V_VT(&index)=VT_I4;
                          V_I4(&index)=0;
                    }
      }
//如果forms是0,那么取fremes数
if(p <=0)
{
if(pHTMLDoc-> get_frames(&pFrames)!=S_OK);       //得到frames指针
    {
    pHTMLDoc-> Release();
    pDisp-> Release();
    pFrames-> Release();
    ShowMessage( "read   frames   failed! ");
    return;
    }
......
}
我做的一个测试程序,提取表单没有问题,为什么老是提示read   frames   failed!,请高手帮忙看看

[解决办法]
看代码觉得没问题。

热点排行