解决方案 »

  1.   

    本帖最后由 VisualEleven 于 2014-05-13 15:21:12 编辑
      

  2.   

    小伙伴们,大伙伴们,大神们。 up > .................
      

  3.   

    UP   ↑↑↑UP   ↑↑↑UP   ↑↑↑
       ↖         ↑         ↗   ←        ↔        →   ↙         ↓         ↘   ╱        ▁        ╲   ▏        ㊣        ▕   ╲        ▔        ╱
      

  4.   

    getAttribute()获取对应节点属性
      

  5.   

    使用com的dispatch接口,不知对否。
      

  6.   

    CComPtr<IDispatch>m_spDisp;

        CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2>m_spDispDoc; CComQIPtr<IHTMLElementCollection, &IID_IHTMLElementCollection>m_spDispAnchs; m_spDisp = (IDispatch *)m_ctrlweb.GetDocument(); m_spDispDoc = m_spDisp; m_spDispDoc->get_all(&m_spDispAnchs);

    LONG len = 0; m_spDispAnchs->get_length(&len); for (int i = 0; i < len; i++)
    {
    CComVariant varName; CComVariant varIndex; varIndex = i; CComPtr<IDispatch> pDisp = NULL; m_spDispAnchs->item(varIndex, varName, &pDisp); CComQIPtr<IHTMLElement>m_spDispAnchs1; m_spDispAnchs1 = pDisp; CComBSTR bstrHref;  m_spDispAnchs1->get_tagName(&bstrHref);  if (i == 5)
    {
    CComBSTR bstrClassName;  m_spDispAnchs1->get_className(&bstrClassName);  CString szClassName(bstrClassName); CComBSTR bstrAttribute("data_value"); long flag = 0; VARIANT pRiant; pRiant.bstrVal = SysAllocString(NULL); pRiant.vt = VT_BSTR; m_spDispAnchs1->getAttribute(bstrAttribute, flag, &pRiant); }
    }我测试的时候pRiant就是"ABCDEFGHIJKLMN",用其它网页试的话,可能不是第5个,这要你自己查看。另外我测试的网页代码是:<html>
    <body>
    <a class= >
    <span class="xx"  data_value="ABCDEFGHIJKLMN"  bty="down">TEST</span>
    </a>
    </body>
    </html>
      

  7.   

    com去获取很蛋疼  egg stay
      

  8.   

    EGG STAY .......... 你?