16,372
社区成员




UINT ReadWebFile(LPVOID pParam)
{
// ------------------------------读网络内容
CInternetSession session;
CString url = "http://115.159.63.120/mysoft/20150809.txt";
try
{
CHttpFile* pFile = (CHttpFile*)session.OpenURL(url,1,INTERNET_FLAG_TRANSFER_ASCII | INTERNET_FLAG_RELOAD, NULL, 0);
DWORD dwRet;
int row;
CString str;
CString outText[20];
for (int i = 0; i < 20; i++)
outText[i].Empty();
int outTextRow = 0;
pFile->QueryInfoStatusCode(dwRet);
switch (dwRet)
{
case 200:
do
{
row = pFile->ReadString(str);
outText[outTextRow] = str;
outTextRow++;
str.Empty();
} while (row>0);
if (outText[0] == "stop")
{
AfxMessageBox("本软件已停止运行,请下载最新版!");
exit(0);
}
g_GM.m_OKTest.m_nErrorLinkWeb=-1;
pFile->Close();
for (int i = 0; i < 20; i++)
outText[i].Empty();
break;
default:
g_GM.m_OKTest.m_nErrorLinkWeb++;
}
}
catch (CInternetException* pEx)
{
pEx->Delete();
g_GM.m_OKTest.m_nErrorLinkWeb++;
}
session.Close();
}
return 0;
}
do
{
row = pFile->ReadString(str);
outText[outTextRow] = str;
outTextRow++;
} while (row>0 && outTextRow<20);
测了一下,也只到13,