利用WinInet进行网络编程的一个例子。
时间:2010-09-21 来源:thanklife
|
m_out += _T("Trying ") +URL + _T("\r\n");
UpdateData(FALSE);
CInternetFile *file = NULL;
try
{
file = (CInternetFile *)session.OpenURL(URL);
}
catch (CInternetException* pEx)
{
file = NULL;
pEx->Delete();
}
if (file)
{
m_out += _T(" Connectiong setalished.\r\n ");
CString line;
for(int i=0; file->ReadString(line); i++)
{
m_out += line + _T("\r\n");
}
file->Close();
delete file;
}
else
{
m_out+= _T("No server found there.\r\n");
}
m_out += _T("-------------------------------------------------\r\n");
UpdateData(FALSE);
相关阅读 更多 +