|
- <DIV id=highlighter_515789 class="syntaxhighlighter cpp ie">
- <DIV class=container>
- <DIV class="line number1 index0 alt2"><CODE class="cpp comments"><FONT face=新宋体>//首先在头文件中包含 #include <AFXINET.H> </FONT></CODE></DIV>
- <DIV class="line number2 index1 alt1"><CODE class="cpp plain"><FONT face=新宋体>CInternetSession session; </FONT></CODE></DIV>
- <DIV class="line number3 index2 alt2"><FONT face=新宋体><CODE class="cpp plain">CHttpFile *pF=(CHttpFile *)session.OpenURL(</CODE><CODE class="cpp string">"<A ><FONT color=#0000ff>http://www.cnblogs.com/VCdog/archive/2011/10/15/2212863.html</FONT></A>"</CODE><CODE class="cpp plain">); </CODE></FONT></DIV>
- <DIV class="line number4 index3 alt1"><CODE class="cpp plain"><FONT face=新宋体>CString strTempData; </FONT></CODE></DIV>
- <DIV class="line number5 index4 alt2"><CODE class="cpp plain"><FONT face=新宋体>CString strData; </FONT></CODE></DIV>
- <DIV class="line number6 index5 alt1"><CODE class="cpp keyword bold"><FONT face=新宋体>while</FONT></CODE> <CODE class="cpp plain"><FONT face=新宋体>(pF->ReadString(strTempData)) </FONT></CODE></DIV>
- <DIV class="line number7 index6 alt2"><CODE class="cpp plain"><FONT face=新宋体>{ </FONT></CODE></DIV>
- <DIV class="line number8 index7 alt1"><FONT face=新宋体><CODE class="cpp spaces"> </CODE><CODE class="cpp plain">strData+=</CODE><CODE class="cpp string">"\r\n"</CODE><CODE class="cpp plain">; </CODE></FONT></DIV>
- <DIV class="line number9 index8 alt2"><FONT face=新宋体><CODE class="cpp spaces"> </CODE><CODE class="cpp plain">strData+=strTempData; </CODE></FONT></DIV>
- <DIV class="line number10 index9 alt1"><CODE class="cpp plain"><FONT face=新宋体>} </FONT></CODE></DIV>
- <DIV class="line number11 index10 alt2"><FONT face=新宋体><CODE class="cpp plain">AfxMessageBox(strData);</CODE><CODE class="cpp comments">//显示网页源代码 </CODE></FONT></DIV>
- <DIV class="line number12 index11 alt1"><FONT face=新宋体><CODE class="cpp plain">session.Close(); </CODE><CODE class="cpp comments">//关闭会话</CODE></FONT></DIV></DIV></DIV>
复制代码 |
|