网易轻松一刻手机版:网络出问题的时候怎么处理?

来源:百度文库 编辑:中科新闻网 时间:2024/04/28 13:45:58
我用MFC编程的时候用到CInternetSession。如果网络出了问题,比如断网了,代理服务器没有反应了,就会提示出错:
void AFXAPI AfxThrowInternetException(DWORD_PTR dwContext, DWORD dwError /* = 0 */)
{
if (dwError == 0)
dwError = ::GetLastError();

CInternetException* pException = new CInternetException(dwError);
pException->m_dwContext = dwContext;

TRACE(traceInternet, 0, "Warning: throwing CInternetException for error %d\n", dwError);
THROW(pException);
}
到这里程序自动退出了。
这样的网络故障在程序中怎么处理?