分类: C/C++
2012-08-26 23:00:41
CString strsource;
CString Address;
CHttpFile *myHttpFile = NULL;
CInternetSession mySession(NULL,0);
Address=" //ip138网页
myHttpFile = (CHttpFile*) mySession.OpenURL(Address); //读取网络地址
while(myHttpFile->ReadString(strsource))
{ //循环读取下载来的网页文本
// AddToLog(strsource);
pDlg->m_Edit1 += "机器公网IP: " + strsource +"\r\n\r\n";
//UpdateData(FALSE);
pDlg->PostMessage(WM_UPDATE_INFO);
//SetDlgItemText(IDC_NET_IP,m_Edit1);//在左下角显示外网ip
}
mySession.Close();
myHttpFile->Close();
delete myHttpFile;
myHttpFile = NULL;