为什么程序中定义CInternetSession时会出错

chenchangxiong chenchangxiong 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

#include "HtmlGetter.h"
#include <afxinet.h>
#include <wininet.h>


HtmlGetter::HtmlGetter()
{

}

HtmlGetter::~HtmlGetter()
{

}

bool HtmlGetter::GetHtml(CString URL, CString& htmlString) {
CInternetSession session;
CInternetFile* file = NULL;
try {
file = (CInternetFile*) session.OpenURL(URL);
}
catch (CInternetException* m_pException) {
file = NULL;
m_pException->Delete();
}


if (file) {
CString somecode;
htmlString = "";
while (file->ReadString(somecode) != NULL) {
htmlString += somecode;
}

file->Close();
delete file;
return true;
}
else {
return false;
}[code=C/C++]

}[/code]
程序如上,运行到CInternetSession session 这行就出错,十分不解和迷茫,忘高人指点啊
...全文
评论 4
收藏 已收藏
分享
返回顶部
chenchangxiong
VC/MFC 16,550 成员 421,606 内容