抓取网页内容的实例我就是对输入的URL确定按钮添加函数,为什么出现了这样的错误呢,不知从哪里下手了
我的代码是
void CGetHttpStrDlg::OnOK() 
{
// TODO: Add extra validation here
//获取输入的URL
CString strUrl;
GetDlgItemText(IDC_EDT_URL,strUrl);
//创建Internet会话
CInternetSession session(NULL,0);
CHttpFile*file=NULL;
CString strContent;
//打开URL
try
{
   file=(CHttpFile*)session.OpenURL(strUrl);
}
catch(CInternetException*pException)
{
   pException->ReportError();
   pException->Delete();
   return;
}
//循环读取内容
CString strTemp;
while(file->ReadString(strTemp))
{
   strContent+=strTemp;
}
//释放资源
file->Close();
delete file;
session.Close();
SetDlgItemText(IDC_EDT_CONTENT,strContent);
// CDialog::OnOK();
}
它提示的错误时
 D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(179) :errorC2065: 'CInternetSession' : undeclared identifier
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(179) : error C2146: syntax error : missing ';' before identifier 'session'
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(179) : error C2065: 'session' : undeclared identifier
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(180) : error C2065: 'CHttpFile' : undeclared identifier
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(180) : error C2065: 'file' : undeclared identifier
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(180) : error C2106: '=' : left operand must be l-value
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(185) : error C2059: syntax error : ')'
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(187) : error C2061: syntax error : identifier 'CInternetException'
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(187) : error C2310: catch handlers must specify one type
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(189) : error C2065: 'pException' : undeclared identifier
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(189) : error C2227: left of '->ReportError' must point to class/struct/union
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(190) : error C2227: left of '->Delete' must point to class/struct/union
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(194) : error C2317: 'try' block starting on line '184' has no catch handlers
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(195) : error C2227: left of '->ReadString' must point to class/struct/union
D:\全部\网络开发篇章\GetHttpStr\GetHttpStrDlg.cpp(195) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.GetHttpStr.exe - 15 error(s), 0 warning(s)
URL