读取网页的内容

void CMy7877Dlg::OnOK()  

{

// TODO: Add extra validation here



UpdateData(TRUE);

CInternetSession session("HttpClient");   

 url = m_a;   

  CHttpFile* pfile = (CHttpFile *)session.OpenURL(url);   

    

  DWORD dwStatusCode;   

  pfile -> QueryInfoStatusCode(dwStatusCode);   

  if(dwStatusCode == HTTP_STATUS_OK)   

  {   

  CString content;   

  CString data;   

  while (pfile -> ReadString(data))   

  {   

  content += data + "\r\n";   

  }   

  content.TrimRight();   

  m_b=((LPCTSTR)content);   

  UpdateData(FALSE);

}   

  pfile -> Close();   

  delete pfile;   

  session.Close();   



}


你可能感兴趣的:(读取)