获取互联网上指定HTTP地址处的网页或数据文件 应该用哪个命令 如何做? 哪个大哥说下!
解决方案 »
- 寻求高手帮助 怎么让PPT在预定窗口显示
- 在透明的背景上写字的问题?
- 请教大家:一个关于 wix 制作安装包的问题(Merge属性)
- dll里能保存数据吗?
- 急问:类模版问题!!
- 如何从DLL中向主程序添加菜单啊??
- One or more breakpoints cannot be set and have been disabled.Execution will stop at the beginning of the program.
- 用MFC能实现基于1553B总线的接收程序吗
- 文本文件转化成Excel文件
- WebBrowser 每条线程独立 cookie
- 在VC里调用javascript
- DLL工程使用STL hash_map编译出现告警,咋回事???
CHttpFile* myHttpFile=NULL;
myHttpFile=(CHttpFile*)mySession.OpenURL(lpszURL,1);
{
CString strURL = TEXT("http://192.168.2.232/1.htm"); // 要打开的网址
CInternetSession session;
try
{
CHttpFile *pHttpFile = (CHttpFile*)session.OpenURL( strURL );
if ( pHttpFile == NULL )
{
m_StHTML.SetWindowText( TEXT("Get web page failed!") );
return;
} CString strHTML = TEXT("");
unsigned long lFile = (unsigned long)pHttpFile->GetLength();
if ( lFile == 0 )
{
m_StHTML.SetWindowText( TEXT("file length is 0.") );
}
else
{
char *pszBuf = new char[lFile + 1];
memset( pszBuf, 0, lFile + 1 );
pHttpFile->Read( pszBuf, lFile ); delete[] pszBuf;
pszBuf = NULL;
}
pHttpFile->Close();
session.Close();
}
catch( CInternetException *e )
{ }
}