利用CInternetSession从网站获取信息,并利用CString拆分查找特定信息
2008-06-02 23:17
507 查看
getsockname
CInternetSession::OpenURL
internetopenurl
connect
SockGetHostByName 此4个为连接地址的函数 它们都会用到url 或者远程的地址
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#include "stdafx.h"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#include "HttpRequest.h"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#include "HttpRequestDlg.h"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#ifdef _DEBUG
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#define new DEBUG_NEW
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#undef THIS_FILE
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
static char THIS_FILE[] = __FILE__;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#endif
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//////////////////////////////////////////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// CHttpRequestDlg dialog
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
CHttpRequestDlg::CHttpRequestDlg(CWnd* pParent /**//*=NULL*/)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
: CDialog(CHttpRequestDlg::IDD, pParent)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//{{AFX_DATA_INIT(CHttpRequestDlg)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//}}AFX_DATA_INIT
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::DoDataExchange(CDataExchange* pDX)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CDialog::DoDataExchange(pDX);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//{{AFX_DATA_MAP(CHttpRequestDlg)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_TITLE_END, m_titleend);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_TITLE_START, m_titlestart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_HREF_LIST_END, m_hreflistend);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_HREF_LIST_START, m_hrefliststart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_MSG, m_msg);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_HTTP_ADDR, m_httpaddr);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_HREF_START, m_hrefstart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_HREF_END, m_hrefend);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_CON_START, m_constart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_CON_END, m_conend);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//}}AFX_DATA_MAP
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
BEGIN_MESSAGE_MAP(CHttpRequestDlg, CDialog)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//{{AFX_MSG_MAP(CHttpRequestDlg)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
ON_WM_PAINT()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
ON_WM_QUERYDRAGICON()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
ON_BN_CLICKED(IDC_START_MSG, OnStartMsg)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//}}AFX_MSG_MAP
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
END_MESSAGE_MAP()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//////////////////////////////////////////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// CHttpRequestDlg message handlers
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
BOOL CHttpRequestDlg::OnInitDialog()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CDialog::OnInitDialog();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// Set the icon for this dialog. The framework does this automatically
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// when the application's main window is not a dialog
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
SetIcon(m_hIcon, TRUE); // Set big icon
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
SetIcon(m_hIcon, FALSE); // Set small icon
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// TODO: Add extra initialization here
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
////先初始化//////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_httpaddr.SetWindowText("http://news.szren.com/shenzhen/Index.html");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hrefliststart.SetWindowText(" <td class=fontindex14px width=643 bgColor=#ffffff><STRONG>深圳新闻</STRONG></td>");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hreflistend.SetWindowText(" <table cellSpacing=0 cellPadding=0 width=650 align=center border=0>");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hrefstart.SetWindowText("href="");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hrefend.SetWindowText(""");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_titlestart.SetWindowText("<title>");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_titleend.SetWindowText("_深圳新闻_深圳人</title>");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_constart.SetWindowText("<td class=news-zhengwenneirong>");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_conend.SetWindowText("</P></P></td>");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return TRUE; // return TRUE unless you set the focus to a control
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// If you add a minimize button to your dialog, you will need the code below
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// to draw the icon. For MFC applications using the document/view model,
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// this is automatically done for you by the framework.
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::OnPaint()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if (IsIconic())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CPaintDC dc(this); // device context for painting
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// Center icon in client rectangle
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int cxIcon = GetSystemMetrics(SM_CXICON);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int cyIcon = GetSystemMetrics(SM_CYICON);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CRect rect;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
GetClientRect(&rect);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int x = (rect.Width() - cxIcon + 1) / 2;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int y = (rect.Height() - cyIcon + 1) / 2;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// Draw the icon
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
dc.DrawIcon(x, y, m_hIcon);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CDialog::OnPaint();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// The system calls this to obtain the cursor to display while the user drags
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// the minimized window.
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
HCURSOR CHttpRequestDlg::OnQueryDragIcon()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return (HCURSOR) m_hIcon;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::OnCancel()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// TODO: Add extra cleanup here
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CDialog::OnCancel();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::OnOK()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// TODO: Add extra validation here
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//CDialog::OnOK();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//检测用户所填写的是否为空
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
BOOL CHttpRequestDlg::checkedit()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
BOOL Cando=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(m_httpaddr.GetWindowTextLength()==0) Cando=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(m_hrefliststart.GetWindowTextLength()==0) Cando=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(m_hreflistend.GetWindowTextLength()==0) Cando=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(m_hrefstart.GetWindowTextLength()==0) Cando=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(m_hrefend.GetWindowTextLength()==0) Cando=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return Cando;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**///////获取首页信息////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::OnStartMsg()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(!checkedit())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
MessageBox("请填写完整信息!",NULL,MB_OK);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CInternetSession mySession(NULL,0);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CHttpFile* myHttpFile=NULL;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString newsdata;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_httpaddr.GetWindowText(newsdata);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
myHttpFile=(CHttpFile*)mySession.OpenURL(newsdata);//打开连接
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString myData;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
newsdata = "";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
while(myHttpFile->ReadString(myData))//循环读文件信息
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
newsdata=newsdata+" ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
newsdata+=myData;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
myHttpFile->Close() ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
mySession.Close() ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//m_msg.SetWindowText(newsdata);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
PrintHref(newsdata);//获取新闻连接列表//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//获取新闻连接列表//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::PrintHref(CString printstr)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString str=printstr,strtemp,strnew,hrefstr="";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int istart=0,iend=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//获取链表范围
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hrefliststart.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = str.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hreflistend.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
iend = str.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strnew = str.Mid(istart,iend-istart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//在链表范围内循环读新闻连接
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
for(int i=0;i<8;i++)...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hrefstart.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = strnew.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = istart+strtemp.GetLength();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strnew = strnew.Mid(istart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hrefend.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
iend = strnew.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
hrefstr = hrefstr+strnew.Mid(0,iend)+" ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_msg.SetWindowText(hrefstr);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
PrintCon(hrefstr);//分析新闻连接列表//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//分析新闻连接列表//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::PrintCon(CString constr)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString str=constr,strtemp,strnew;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int istart=0,iend=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
for(int i=0;i<8;i++)...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = str.Find(" ");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strnew = str.Left(istart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**//*************************/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**//*对每一个连接分析内容****/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**//*************************/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
GetNewsCon(strnew);//获取一个新闻内容//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**//*************************/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = istart + 2;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
str = str.Mid(istart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//m_msg.SetWindowText(str);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//获取一个新闻内容//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::GetNewsCon(CString NewsUrl)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CInternetSession mySession(NULL,0);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CHttpFile* myHttpFile=NULL;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
myHttpFile=(CHttpFile*)mySession.OpenURL(NewsUrl);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString myData;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString newsdata = "";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
while(myHttpFile->ReadString(myData))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
newsdata=newsdata+" ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
newsdata+=myData;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
myHttpFile->Close() ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
mySession.Close() ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
PrintNewsCon(newsdata);//分析一个新闻内容//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//分析一个新闻内容//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::PrintNewsCon(CString NewsUrl)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString str=NewsUrl,strtemp,strnew,msg;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int istart=0,iend=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////获取标题
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_titlestart.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = str.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = istart + strtemp.GetLength();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_titleend.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
iend = str.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strnew = str.Mid(istart,iend-istart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_msg.GetWindowText(msg);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
msg = msg + strnew + " ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_msg.SetWindowText(msg);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////获取内容
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_constart.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = str.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = istart + strtemp.GetLength();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_conend.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
iend = str.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strnew = str.Mid(istart,iend-istart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_msg.GetWindowText(msg);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
msg = msg + strnew + "</p></p>" + " ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_msg.SetWindowText(msg);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
CInternetSession::OpenURL
internetopenurl
connect
SockGetHostByName 此4个为连接地址的函数 它们都会用到url 或者远程的地址
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#include "stdafx.h"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#include "HttpRequest.h"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#include "HttpRequestDlg.h"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#ifdef _DEBUG
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#define new DEBUG_NEW
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#undef THIS_FILE
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
static char THIS_FILE[] = __FILE__;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#endif
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//////////////////////////////////////////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// CHttpRequestDlg dialog
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
CHttpRequestDlg::CHttpRequestDlg(CWnd* pParent /**//*=NULL*/)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
: CDialog(CHttpRequestDlg::IDD, pParent)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//{{AFX_DATA_INIT(CHttpRequestDlg)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//}}AFX_DATA_INIT
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::DoDataExchange(CDataExchange* pDX)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CDialog::DoDataExchange(pDX);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//{{AFX_DATA_MAP(CHttpRequestDlg)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_TITLE_END, m_titleend);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_TITLE_START, m_titlestart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_HREF_LIST_END, m_hreflistend);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_HREF_LIST_START, m_hrefliststart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_MSG, m_msg);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_HTTP_ADDR, m_httpaddr);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_HREF_START, m_hrefstart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_HREF_END, m_hrefend);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_CON_START, m_constart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DDX_Control(pDX, IDC_CON_END, m_conend);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//}}AFX_DATA_MAP
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
BEGIN_MESSAGE_MAP(CHttpRequestDlg, CDialog)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//{{AFX_MSG_MAP(CHttpRequestDlg)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
ON_WM_PAINT()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
ON_WM_QUERYDRAGICON()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
ON_BN_CLICKED(IDC_START_MSG, OnStartMsg)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//}}AFX_MSG_MAP
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
END_MESSAGE_MAP()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//////////////////////////////////////////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// CHttpRequestDlg message handlers
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
BOOL CHttpRequestDlg::OnInitDialog()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CDialog::OnInitDialog();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// Set the icon for this dialog. The framework does this automatically
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// when the application's main window is not a dialog
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
SetIcon(m_hIcon, TRUE); // Set big icon
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
SetIcon(m_hIcon, FALSE); // Set small icon
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// TODO: Add extra initialization here
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
////先初始化//////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_httpaddr.SetWindowText("http://news.szren.com/shenzhen/Index.html");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hrefliststart.SetWindowText(" <td class=fontindex14px width=643 bgColor=#ffffff><STRONG>深圳新闻</STRONG></td>");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hreflistend.SetWindowText(" <table cellSpacing=0 cellPadding=0 width=650 align=center border=0>");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hrefstart.SetWindowText("href="");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hrefend.SetWindowText(""");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_titlestart.SetWindowText("<title>");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_titleend.SetWindowText("_深圳新闻_深圳人</title>");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_constart.SetWindowText("<td class=news-zhengwenneirong>");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_conend.SetWindowText("</P></P></td>");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return TRUE; // return TRUE unless you set the focus to a control
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// If you add a minimize button to your dialog, you will need the code below
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// to draw the icon. For MFC applications using the document/view model,
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// this is automatically done for you by the framework.
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::OnPaint()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if (IsIconic())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CPaintDC dc(this); // device context for painting
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// Center icon in client rectangle
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int cxIcon = GetSystemMetrics(SM_CXICON);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int cyIcon = GetSystemMetrics(SM_CYICON);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CRect rect;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
GetClientRect(&rect);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int x = (rect.Width() - cxIcon + 1) / 2;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int y = (rect.Height() - cyIcon + 1) / 2;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// Draw the icon
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
dc.DrawIcon(x, y, m_hIcon);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CDialog::OnPaint();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// The system calls this to obtain the cursor to display while the user drags
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
// the minimized window.
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
HCURSOR CHttpRequestDlg::OnQueryDragIcon()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return (HCURSOR) m_hIcon;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::OnCancel()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// TODO: Add extra cleanup here
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CDialog::OnCancel();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::OnOK()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// TODO: Add extra validation here
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//CDialog::OnOK();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//检测用户所填写的是否为空
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
BOOL CHttpRequestDlg::checkedit()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
BOOL Cando=true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(m_httpaddr.GetWindowTextLength()==0) Cando=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(m_hrefliststart.GetWindowTextLength()==0) Cando=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(m_hreflistend.GetWindowTextLength()==0) Cando=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(m_hrefstart.GetWindowTextLength()==0) Cando=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(m_hrefend.GetWindowTextLength()==0) Cando=false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return Cando;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**///////获取首页信息////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::OnStartMsg()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(!checkedit())
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
MessageBox("请填写完整信息!",NULL,MB_OK);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CInternetSession mySession(NULL,0);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CHttpFile* myHttpFile=NULL;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString newsdata;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_httpaddr.GetWindowText(newsdata);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
myHttpFile=(CHttpFile*)mySession.OpenURL(newsdata);//打开连接
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString myData;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
newsdata = "";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
while(myHttpFile->ReadString(myData))//循环读文件信息
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
newsdata=newsdata+" ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
newsdata+=myData;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
myHttpFile->Close() ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
mySession.Close() ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//m_msg.SetWindowText(newsdata);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
PrintHref(newsdata);//获取新闻连接列表//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//获取新闻连接列表//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::PrintHref(CString printstr)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString str=printstr,strtemp,strnew,hrefstr="";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int istart=0,iend=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//获取链表范围
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hrefliststart.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = str.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hreflistend.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
iend = str.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strnew = str.Mid(istart,iend-istart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//在链表范围内循环读新闻连接
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
for(int i=0;i<8;i++)...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hrefstart.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = strnew.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = istart+strtemp.GetLength();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strnew = strnew.Mid(istart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_hrefend.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
iend = strnew.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
hrefstr = hrefstr+strnew.Mid(0,iend)+" ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_msg.SetWindowText(hrefstr);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
PrintCon(hrefstr);//分析新闻连接列表//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//分析新闻连接列表//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::PrintCon(CString constr)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString str=constr,strtemp,strnew;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int istart=0,iend=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
for(int i=0;i<8;i++)...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = str.Find(" ");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strnew = str.Left(istart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**//*************************/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**//*对每一个连接分析内容****/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**//*************************/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
GetNewsCon(strnew);//获取一个新闻内容//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**//*************************/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = istart + 2;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
str = str.Mid(istart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//m_msg.SetWindowText(str);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//获取一个新闻内容//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::GetNewsCon(CString NewsUrl)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CInternetSession mySession(NULL,0);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CHttpFile* myHttpFile=NULL;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
myHttpFile=(CHttpFile*)mySession.OpenURL(NewsUrl);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString myData;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString newsdata = "";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
while(myHttpFile->ReadString(myData))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
newsdata=newsdata+" ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
newsdata+=myData;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
myHttpFile->Close() ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
mySession.Close() ;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
PrintNewsCon(newsdata);//分析一个新闻内容//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//分析一个新闻内容//////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
void CHttpRequestDlg::PrintNewsCon(CString NewsUrl)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CString str=NewsUrl,strtemp,strnew,msg;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int istart=0,iend=0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////获取标题
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_titlestart.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = str.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = istart + strtemp.GetLength();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_titleend.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
iend = str.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strnew = str.Mid(istart,iend-istart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_msg.GetWindowText(msg);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
msg = msg + strnew + " ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_msg.SetWindowText(msg);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////获取内容
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_constart.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = str.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
istart = istart + strtemp.GetLength();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_conend.GetWindowText(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
iend = str.Find(strtemp);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strnew = str.Mid(istart,iend-istart);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_msg.GetWindowText(msg);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
msg = msg + strnew + "</p></p>" + " ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
m_msg.SetWindowText(msg);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////////////////////////////////////////
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
相关文章推荐
- CInternetSession从网站获取信息,并利用CString拆分查找特定信息
- 利用HttpRequest登录到某个网站,然后获取网站信息的程序示例
- 利用HttpRequest 利用HttpRequest登录到某个网站,然后获取网站信息的程序示例
- 利用HttpRequest登录到某个网站,然后获取网站信息的程序示例
- [asp.net]利用HttpRequest登录到某个网站,然后获取网站信息
- Web网站中利用JavaScript中ActiveXObject对象获取硬件信息(显示器数量、分辨率)从而进行单双屏跳转
- 利用百度地图Geocoding API获取特定地区或地址的经纬度信息
- [asp.net]利用HttpRequest登录到某个网站,然后获取网站信息
- 利用HttpRequest登录到某个网站,然后获取网站信息的程序示例 [原创]
- 利用google map获取特定地区或地址的经纬度信息
- [C#.Net]利用HttpRequest登录到某个网站,然后获取网站信息的程序示例
- 利用HttpRequest登录到某个网站,然后获取网站信息的程序示例
- 利用HttpRequest登录到某个网站,然后获取网站信息的程序示例
- 利用HttpRequest登录到某个网站,然后获取网站信息的程序示例
- 如何获取和利用“用户及其使用网站原因的信息”
- 利用HttpRequest登录到某个网站,然后获取网站信息的程序示例
- 利用js获取网站地址中的参数
- 利用cURL来获取网页信息-Using cURL to get webpage content
- 利用php获取图片完整Exif信息类 获取图片详细完整信息类
- spring利用扫描方式对bean的处理(对任何版本如何获取xml配置信息的处理)