18,356
社区成员
发帖
与我相关
我的任务
分享
try{
CInternetSession l_cSess("GetJson");
CHttpFile *pF = (CHttpFile *) l_cSession.OpenURL(""http://server/manger/Authorize?method=get");//异常跳走
DWORD l_dwStatus;
pF->QueryInfoStatusCode(l_dwStatus);
//剩下的代码
}
cathc(CInternetException *e)
{
m_dwErrCode = e->m_dwError; //12006
//.........
}
try{
char * l_strUrl = "http://server/manger/Authorize?method=get";
CInternetSession l_cSess("GetJson");
CHttpFile *pF = (CHttpFile *) l_cSession.OpenURL((LPCTSTR)l_strUrl );//异常跳走
DWORD l_dwStatus;
pF->QueryInfoStatusCode(l_dwStatus);
//剩下的代码
}
cathc(CInternetException *e)
{
m_dwErrCode = e->m_dwError; //12006
//.........
}
看来强制类型转化还是有问题的。
我通过修改代码如下.
try{
CSting l_strUrl("http://server/manger/Authorize?method=get");
CInternetSession l_cSess("GetJson");
CHttpFile *pF = (CHttpFile *) l_cSession.OpenURL(l_strUrl );
DWORD l_dwStatus;
pF->QueryInfoStatusCode(l_dwStatus);
//剩下的代码
}
cathc(CInternetException *e)
{
m_dwErrCode = e->m_dwError;
//.........
}
则没有问题,有没有大神原因告诉一下原因?