大家帮我看看,我的线程哪里有毛病
我在dlg.h中加入
UINT Thread1(LPVOID);
然后在dlg.cpp中加入:
AfxBeginThread(Thread1,0);
UINT Thread1(LPVOID p)
{
CpagedownDlg *dlg = (CpagedownDlg*)AfxGetApp()->GetMainWnd();
CInternetSession* pSession;
CHttpFile* pFile = NULL;
pSession = new CInternetSession;
pFile = (CHttpFile*)pSession->OpenURL(dlg->m_strAddress);
CString str;
dlg->m_strText = "";
dlg->UpdateData(FALSE);
while(pFile->ReadString(str))
{
dlg->m_strText = dlg->m_strText + "\r\n";
dlg->m_strText += str;
}
dlg->UpdateData(FALSE);
pFile->Close();
pSession->Close();
AfxEndThread(0);
return 0;
}
pagedown.exe 中的 0x00000001 处未处理的异常: 0xC0000005: 读取位置 0x00000001 时发生访问冲突 。