在vc中用chtmlview 生成一个浏览器,当用户在上面选择特定内容时,  
怎样把这些内容对应的html代码提取出来?  
 
比如,用户选择网页中的一个表格,那这个表格对应的html就是  
<table>........</table>之间的内容,  
怎样提取到这部分内容?  
 
对vc  不是很熟悉,希望各个大虾说详细点,  
多谢~!

解决方案 »

  1.   

    你应该能够得到HTML的source,希望你能得到选择的范围,然后你就可以去其中的一部分文本。如果你的不到选择范围,那你只能通过搜索文本的方法来寻找表格。============================================================================
    http://www.betajin.com/alphasun/index.htm           给我发信息请附带原帖地址
    http://alphasun.18en.com/                    http://shakingtoolkit.9126.com/
    DocWizard C++程序文档自动生成工具 | Wave OpenGL | HttpProxy | AjaxParser词法分析
      

  2.   

    还有这个问题应该到html去问void CDlg::pasteSelectionHTML( CString tagBegin, CString tagEnd)
    {
    HRESULT hr;
    CString m_temp;
    IHTMLDocument2* pDoc2 = (IHTMLDocument2* )m_htmlpage.GetHtmlDocument(); 

    IHTMLSelectionObject* pSelection;
    pDoc2->get_selection(&pSelection);
    BSTR value;
    IDispatch* pDisp;
    hr = pSelection->createRange(&pDisp);
    if(SUCCEEDED(hr) && pDisp!= NULL )
    {
    IHTMLTxtRange* pTextAreaElement;
    hr = pDisp->QueryInterface(IID_IHTMLTxtRange,
    (void**)&pTextAreaElement);
    pTextAreaElement->get_text(&value);
    m_temp = value;
    if(m_temp.Find("<!--textbegin-->")!=-1)
    {
    m_temp.Replace("<!--textbegin-->","<!--textbegin-->"+tagBegin);
    tagBegin = "";
    }
    if(m_temp.Find("<!--textend-->")!=-1)
    {
    m_temp.Replace("<!--textend-->", tagEnd + "<!--textend-->");
    tagEnd = "";
    }
    m_temp = tagBegin + m_temp + tagEnd;
    pTextAreaElement->pasteHTML( m_temp.AllocSysString());
    pTextAreaElement->Release();
    }
    ::SysFreeString(value);
    }
      

  3.   

    为什么函数要是 CDlg:: 的呢?请问m_htmlpage是什么类型?整个过程具体要怎么使用?
      

  4.   

    我是在dlg里写的.m_htmlpage是一个htmlCtrl控件.短信息上写的很清楚了.这个问题最好到html\xml中问.在那里会这个的人多