http://www.codeguru.com/ieprogram/HTMLParsing.html
need IE sdk:http://msdn.microsoft.com/downloads/samples/internet/libraries/ie55_lib/

解决方案 »

  1.   

    to masterz():
    test.obj : error LNK2001: unresolved external symbol _IID_IMarkupServices
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/test.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.
    不知道还要加入哪些库呢???
      

  2.   

    看到iesdk的安装页面吗?她要求你把iesdk的include目录移到最上面
      

  3.   

    没有安装页面吧??好像我下载下来的只有include、lib两个目录以及一个.gif文件,没有要求我什么呀~~~~~~我再下载一次试试~~~~~~~
      

  4.   

    哦,我明白你的意思了,你是说在directory里设置,我再试试~~~~~~~
      

  5.   

    你有没有连接它给的lib阿?????
      

  6.   

    to Kevin_qing():
    要连哪个lib呢???
    to masterz():
    果然有效,但还有两个错误,是不能用winMain,只能用main吗???
    错误如下:
    Linking...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/test.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
      

  7.   

    呵呵,最近用这个接口的人剧增呀
    masterz又有分赚了:)
      

  8.   

    加上下面:
    #import <Mshtml.dll>
      

  9.   

    如果还不行,那就把mshtml.dll拷到你的工程目录下#import "mshtml.dll" ,如果还不行,那是你不会用这个com口,要例子email to [email protected]
      

  10.   

    去看http://www.csdn.net/expert/topic/360/360785.shtm 
      

  11.   

    to cai_c_cai(菜菜):
    fatal error C1083: Cannot open type library file: 'Mshtml.dll': 参数数目无效。
    Error executing cl.exe.
    加入绝对路径后还是报错~~~~~~~
      

  12.   

    to jiangsheng(蒋晟):
    看过了,但是例子不好拷,拷下来编译报了很多错,因为缺少其它文件,能不能直接给我mail一份??
    [email protected]
      

  13.   

    http://www.csdn.net/expert/topic/351/351580.shtm里面有完整的
      

  14.   

    Linking...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    project->settings
    c/C++ tab
    preprocessor:
    _CONSOLE 改为_WINDOWS
      

  15.   

    TO masterz():
    应该是这个原因了~~~~~
      

  16.   

    TO masterz():
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/test.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
    Faint,改完后还是一样的错误~~~~~~to jiangsheng(蒋晟):
    好,我一会儿拷下来看看~~~~~
      

  17.   

    project->settings
    link tab
    Project Options中找到
    /subsystem:console
    改为/subsystem:windows
      

  18.   

    to masterz():
    总算连接成功了,但执行后好像什么也不显示,我加了printf语句也是什么也不打印,这例子是不是应该打印出Hello world!呢???
      

  19.   

                  pBody->get_innerText(&strText);             
    就是这样得到html文本分析的结果
      

  20.   

    to masterz():
    谢谢,终于可以看到H了,现在只差由BSTR到char *的类型转换了~~~~~~~
      

  21.   

                  pBody->get_innerText(&strText);
      MessageBoxW(NULL,(LPCWSTR)(strText),L"body innertext",MB_OK);
      

  22.   

    to masterz():
    谢谢,已经看到H了,要看全Hello world,就差从BSTR转换到char *类型了,你知道用什么函数转吗?
    我一会儿调好了就给你们送分~~~~~~
      

  23.   

    你好啊,superrg,我试了一下你为250分的例子:
     得250分 
    http://www.codeguru.com/ieprogram/HTMLParsing.html
    但是有error啊:
    --------------------Configuration: IHTML - Win32 Debug--------------------
    Compiling...
    ParseHTML.cpp
    m:\sample\parsehtml.cpp(30) : error C2065: 'IMarkupServices' : undeclared identifier
    m:\sample\parsehtml.cpp(30) : error C2065: 'pMS' : undeclared identifier
    m:\sample\parsehtml.cpp(30) : error C2106: '=' : left operand must be l-value
    m:\sample\parsehtml.cpp(35) : error C2065: 'IID_IMarkupServices' : undeclared identifier
    m:\sample\parsehtml.cpp(40) : error C2065: 'IMarkupContainer' : undeclared identifier
    m:\sample\parsehtml.cpp(40) : error C2065: 'pMC' : undeclared identifier
    m:\sample\parsehtml.cpp(40) : error C2106: '=' : left operand must be l-value
    m:\sample\parsehtml.cpp(41) : error C2065: 'IMarkupPointer' : undeclared identifier
    m:\sample\parsehtml.cpp(41) : error C2065: 'pMkStart' : undeclared identifier
    m:\sample\parsehtml.cpp(41) : error C2106: '=' : left operand must be l-value
    m:\sample\parsehtml.cpp(42) : error C2065: 'pMkFinish' : undeclared identifier
    m:\sample\parsehtml.cpp(42) : error C2106: '=' : left operand must be l-value
    m:\sample\parsehtml.cpp(44) : error C2227: left of '->CreateMarkupPointer' must point to class/struct/union
    m:\sample\parsehtml.cpp(45) : error C2227: left of '->CreateMarkupPointer' must point to class/struct/union
    m:\sample\parsehtml.cpp(47) : error C2227: left of '->ParseString' must point to class/struct/union
    m:\sample\parsehtml.cpp(57) : error C2227: left of '->QueryInterface' must point to class/struct/union
    m:\sample\parsehtml.cpp(81) : error C2227: left of '->Release' must point to class/struct/union
    m:\sample\parsehtml.cpp(85) : error C2227: left of '->Release' must point to class/struct/union
    m:\sample\parsehtml.cpp(88) : error C2227: left of '->Release' must point to class/struct/union
    m:\sample\parsehtml.cpp(90) : error C2227: left of '->Release' must point to class/struct/union
    Error executing cl.exe.ParseHTML.obj - 20 error(s), 0 warning(s)我已经download include5.5 lib and win2000 sdk,
    also make the right sequence in Tool->option->directories->include..but still error, Help...
    你是怎样解决的??[email protected]谢谢!!
      

  24.   

    to jiangsheng:还好你看到了这里,谢谢你回复啊!那个core win2000 sdk 可是刚刚才拉下来的啊 版本方面没有问题
    include的次序应该也是对的,那么,是什么方面的问题?连编译就不过,还怎样学习啊,help...
    请继续关注啊
      

  25.   

    IMarkupServices要IE5.5版的头文件
    win2000是5.0
    :(
      

  26.   

    对啊,最新的,烫手的已经下载并include:
    IE5.5
    MICROSOFT SDK\INCLUDE
    vc98
    MFC
    ATL
    怎样回事啊,蒋晟?
      

  27.   

    这个include应该是没有错的了:
    IE5.5 \INCLUDE
    MICROSOFT SDK\INCLUDE
    vc98 \INCLUDE
    MFC \INCLUDE
    ATL \INCLUDE有什么可能?
      

  28.   

    Hi,我照[email protected]发了出去,却
        抱歉的通知您,您的邮件无法投递到目的地址,可能的原因是:收信人地址不正确、不
    存在、收信人邮箱空间已满、收
    信人对您的电子邮件地址设置了拒收... 
        请确认后再次尝试发送,如果仍然不能解决问题,请与我们的管理员联系:postmaster
    @163.com,并请一定附上退信。
        谢谢!
    现在就把信post在这里啦已经编译成功!非常感谢你的关注!
    但是问题解决了一个又出现另一个
    我怎样才能看到"hello world"呢?
    我用debug来看似乎看不到。
    那个其实是
    http://www.codeguru.com/ieprogram/HTMLParsing.html
    的例子。见下面
    请到这里领分,等你喔  
    本来我是前天准备顺便搞个空贴 等你到了就给分
    不料竟然也有人回答,不过等你有空到了那up一下,立刻给80分来感谢你的关注
    BSTR OLECHAR CString的关系
    http://www.csdn.net/Expert/topic/495/495175.shtm
    #include <windows.h>
    #include <mshtml.h>OLECHAR szHTML[] = OLESTR("<HTML><BODY>Hello World!</BODY></HTML>");int __stdcall WinMain(HINSTANCE hInst, 
                          HINSTANCE hPrev, 
                          LPSTR lpCmdLine, 
                          int nShowCmd)
    {
      IHTMLDocument2 *pDoc = NULL;  CoInitialize(NULL);  CoCreateInstance(CLSID_HTMLDocument, 
                       NULL, 
                       CLSCTX_INPROC_SERVER, 
                       IID_IHTMLDocument2, 
                       (LPVOID *) &pDoc);  if (pDoc)
      {
        IPersistStreamInit *pPersist = NULL;    pDoc->QueryInterface(IID_IPersistStreamInit, 
                           (LPVOID *) &pPersist);    if (pPersist)
        {
          IMarkupServices *pMS = NULL;
      
          pPersist->InitNew();
          pPersist->Release();      pDoc->QueryInterface(IID_IMarkupServices, 
                                  (LPVOID *) &pMS);      if (pMS)
          {
            IMarkupContainer *pMC = NULL;
            IMarkupPointer *pMkStart = NULL;
            IMarkupPointer *pMkFinish = NULL;        pMS->CreateMarkupPointer(&pMkStart);
            pMS->CreateMarkupPointer(&pMkFinish);        pMS->ParseString(szHTML, 
                             0, 
                             &pMC, 
                             pMkStart, 
                             pMkFinish);        if (pMC)
            {
              IHTMLDocument2 *pNewDoc = NULL;          pMC->QueryInterface(IID_IHTMLDocument, 
                                  (LPVOID *) &pNewDoc);          if (pNewDoc)
              {
                // do anything with pNewDoc, in this case 
                // get the body innerText.            IHTMLElement *pBody;
                pNewDoc->get_body(&pBody);            if (pBody)
                {
                  BSTR strText;              pBody->get_innerText(&strText);
                  pBody->Release();              SysFreeString(strText);
                }            pNewDoc->Release();
              }          pMC->Release();
            }        if (pMkStart)
                pMkStart->Release();        if (pMkFinish)
              pMkFinish->Release();        pMS->Release();
          }
        }    pDoc->Release();
      }  CoUninitialize();
      
      return TRUE;
    }
      

  29.   

    调试输出不一定要在DEBUG窗口的
    写个临时文件就行
      

  30.   

    OK, 糕点!欢迎jiangsheng有空到:http://www.csdn.net/Expert/topic/495/495175.shtm领分只需要up一下,立刻送分。
    感谢关注!!