Winet

/*
#include <afxinet.h>
try {
CInternetSession m_Session ("Microsoft Internet Browser",0);
CHttpFile* m_HttpFile = NULL;

m_Session.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT,1000);
m_Session.SetOption(INTERNET_OPTION_DATA_RECEIVE_TIMEOUT, 1000);
m_Session.SetOption(INTERNET_OPTION_DATA_SEND_TIMEOUT, 1000);
m_Session.SetOption(INTERNET_OPTION_CONNECT_BACKOFF,1000);
m_Session.SetOption(INTERNET_OPTION_CONNECT_RETRIES,2);

m_HttpFile = (CHttpFile*)m_Session.OpenURL("http://community.csdn.net/Expert/topic/4142/4142625.xml?temp=.5210688");
//m_HttpFile = (CHttpFile*)m_Session.OpenURL(m_URL,1,
//INTERNET_FLAG_TRANSFER_ASCII | INTERNET_FLAG_EXISTING_CONNECT |
// INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_DONT_CACHE, NULL,0);

DWORD dwStatusCode;
CString siteInfo;

m_HttpFile->QueryInfoStatusCode(dwStatusCode);
if (dwStatusCode != 200) {// 网页不存在
  MessageBox(" 网页不存在! ");
}

CString myData,str;
while(m_HttpFile->ReadString(myData)) {
   str+=myData;
}
MessageBox(str);
m_HttpFile->Close();
m_Session.Close();
}
catch (CInternetException* pEx) {
pEx->Delete();
MessageBox(" 致命错误! ");
}
*/

你可能感兴趣的:(Winet)