to masterz(): 谢谢,已经看到H了,要看全Hello world,就差从BSTR转换到char *类型了,你知道用什么函数转吗? 我一会儿调好了就给你们送分~~~~~~
你好啊,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]谢谢!!
to jiangsheng:还好你看到了这里,谢谢你回复啊!那个core win2000 sdk 可是刚刚才拉下来的啊 版本方面没有问题 include的次序应该也是对的,那么,是什么方面的问题?连编译就不过,还怎样学习啊,help... 请继续关注啊
IMarkupServices要IE5.5版的头文件 win2000是5.0 :(
对啊,最新的,烫手的已经下载并include: IE5.5 MICROSOFT SDK\INCLUDE vc98 MFC ATL 怎样回事啊,蒋晟?
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.
不知道还要加入哪些库呢???
要连哪个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.
masterz又有分赚了:)
#import <Mshtml.dll>
fatal error C1083: Cannot open type library file: 'Mshtml.dll': 参数数目无效。
Error executing cl.exe.
加入绝对路径后还是报错~~~~~~~
看过了,但是例子不好拷,拷下来编译报了很多错,因为缺少其它文件,能不能直接给我mail一份??
[email protected]
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
project->settings
c/C++ tab
preprocessor:
_CONSOLE 改为_WINDOWS
应该是这个原因了~~~~~
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(蒋晟):
好,我一会儿拷下来看看~~~~~
link tab
Project Options中找到
/subsystem:console
改为/subsystem:windows
总算连接成功了,但执行后好像什么也不显示,我加了printf语句也是什么也不打印,这例子是不是应该打印出Hello world!呢???
就是这样得到html文本分析的结果
谢谢,终于可以看到H了,现在只差由BSTR到char *的类型转换了~~~~~~~
MessageBoxW(NULL,(LPCWSTR)(strText),L"body innertext",MB_OK);
谢谢,已经看到H了,要看全Hello world,就差从BSTR转换到char *类型了,你知道用什么函数转吗?
我一会儿调好了就给你们送分~~~~~~
得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]谢谢!!
include的次序应该也是对的,那么,是什么方面的问题?连编译就不过,还怎样学习啊,help...
请继续关注啊
win2000是5.0
:(
IE5.5
MICROSOFT SDK\INCLUDE
vc98
MFC
ATL
怎样回事啊,蒋晟?
IE5.5 \INCLUDE
MICROSOFT SDK\INCLUDE
vc98 \INCLUDE
MFC \INCLUDE
ATL \INCLUDE有什么可能?
抱歉的通知您,您的邮件无法投递到目的地址,可能的原因是:收信人地址不正确、不
存在、收信人邮箱空间已满、收
信人对您的电子邮件地址设置了拒收...
请确认后再次尝试发送,如果仍然不能解决问题,请与我们的管理员联系: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;
}
写个临时文件就行
感谢关注!!