﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-Liangaixue123</title><link>http://www.cppblog.com/Liangaixue123/</link><description /><language>zh-cn</language><lastBuildDate>Wed, 15 Apr 2026 00:27:40 GMT</lastBuildDate><pubDate>Wed, 15 Apr 2026 00:27:40 GMT</pubDate><ttl>60</ttl><item><title>CWnd* pParent 是什么意思?</title><link>http://www.cppblog.com/Liangaixue123/archive/2016/12/22/214532.html</link><dc:creator>梁川</dc:creator><author>梁川</author><pubDate>Thu, 22 Dec 2016 03:12:00 GMT</pubDate><guid>http://www.cppblog.com/Liangaixue123/archive/2016/12/22/214532.html</guid><wfw:comment>http://www.cppblog.com/Liangaixue123/comments/214532.html</wfw:comment><comments>http://www.cppblog.com/Liangaixue123/archive/2016/12/22/214532.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Liangaixue123/comments/commentRss/214532.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Liangaixue123/services/trackbacks/214532.html</trackback:ping><description><![CDATA[<br /><div style="color: #c0bdbb; font-family: simsun; background-color: #000000;">传递参数的时候,需要传递父窗口指针,但是如果你的程序某些时候不需要用到父窗口,那只要用NULL把这个参数缺省掉就可以了.<br /><br /><br /><span style="word-wrap: normal; word-break: normal; line-height: 21px;">m_hIcon = AfxGetApp()-&gt;LoadIcon(IDR_MAINFRAME)是什么意思?</span><div>在资源视图里展开icon看到,这个标志iDR_MAiNFRAME，双击它就是一个图标&#8220;MFC&#8221;；注意这个函数就是获取这个icon的句柄，以便以后用Drawicon(句柄)，把它画在标题栏</div><div style="padding-right: 24px; padding-bottom: 10px; padding-left: 24px;"><div>&nbsp;<wbr></div>如果添加了资源,ID 为IDI_ICON1,调用时直接:AfxGetApp()-&gt;LoadIcon(IDI_ICON1);<br />但是这种方法并不能加载系统预定义图标,在CWinApp中还有个装载图标的函数:<br />HICON LoadStandardIcon( LPCTSTR lpszIconName ) const;<br />如:<br />AfxGetApp()-&gt;LoadStandardIcon(IDI_QUESTION);</div><div style="padding-right: 24px; padding-bottom: 10px; padding-left: 24px;">&nbsp;<wbr></div><div><span style="word-wrap: normal; word-break: normal; line-height: 21px;">CWnd::OnQueryDragIcon</span>　　</div><div>afx_msg HCURSOR OnQueryDragIcon( );</div><div></div><div>　　返回值：</div><div></div><div>　　一个双字值，它在低位字中包含了光标或图标的句柄。光标和图标必须与显示器的分辨率匹配。如果应用程序返回NULL，则系统将显示缺省的光标。缺省的返回值是NULL。</div><div></div><div>　　说明：</div><div></div><div>　　框架为不具有为类图标的最小化（图标化）窗口调用这个成员函数。系统调用这个函数以在用户拖拉最小化窗口的时候显示光标。</div><div></div><div>　　如果应用程序返回图标或光标的句柄，系统将它转换为黑与白。</div><div></div><div>　　如果应用程序返回一个句柄，则这个句柄必须标识与显示设备分辨率相兼容的单色光标或图标。应用程序可以调用CWinApp::LoadCursor或CWinApp::LoadIcon成员函数以从它的可执行文件的资源中载入光标或图标并获得其句柄。</div></div><img src ="http://www.cppblog.com/Liangaixue123/aggbug/214532.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Liangaixue123/" target="_blank">梁川</a> 2016-12-22 11:12 <a href="http://www.cppblog.com/Liangaixue123/archive/2016/12/22/214532.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>谈谈什么是IO流</title><link>http://www.cppblog.com/Liangaixue123/archive/2016/12/22/214515.html</link><dc:creator>梁川</dc:creator><author>梁川</author><pubDate>Thu, 22 Dec 2016 00:38:00 GMT</pubDate><guid>http://www.cppblog.com/Liangaixue123/archive/2016/12/22/214515.html</guid><wfw:comment>http://www.cppblog.com/Liangaixue123/comments/214515.html</wfw:comment><comments>http://www.cppblog.com/Liangaixue123/archive/2016/12/22/214515.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Liangaixue123/comments/commentRss/214515.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Liangaixue123/services/trackbacks/214515.html</trackback:ping><description><![CDATA[&nbsp; &nbsp; &nbsp;流是磁盘或其它外围设备中存储的数据的原点或终点。流主要是指一种逻辑上的概念，它提供或存储数据。产生数据的叫输入流，消耗数据的叫输出流。至于怎么产生，又怎么消耗，这是一种物理上的实现，根据每种设备有所不同。对于流的使用者不用关心太多细节。体现了计算机的核心思想对复杂的东西抽象化。c语言中对IO流的不同角度有不同划分。有诸多形象的例子，比如设备与文件直接传输过程就像一个房间里放着一块冰，一个房间需要用水；那么最简单的方式就是融合它，以水的方式流过去。<br />&nbsp; &nbsp; &nbsp;<strong>流的分类</strong>：1.按照流向分为输入流和输出流。<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.按照数据的表现形式分为：字节流（二进制，可以处理一切文件，文本，音频等）和字符流（文本文件，只能是纯文本，像txt）<br />&nbsp; &nbsp; &nbsp;<strong>文本流：</strong>文本流的特点是流由文本行组成，每一行由0个或多个字符并以'\n'结束，即它是有一定意义的，以某种字符集的字符组成的一个序列。一个文本流，读入与写出时可能 &nbsp; 会对其内容做更改，因为它是有一定意义的，系统可以识别并在适当时候解释，比如在输出文本流中遇到'\b'时，系统的操作是将输入流中的前一个字符删除，在终端上显示就是在它前面输出的这个字符被删除了。<br />&nbsp; &nbsp; <strong>&nbsp;二进制流：</strong>二进制流完成由一些&#8220;生&#8221;的，未经处理的数据组成的，c语言将它们看成由0与1组成的序列来读与写，所以它们的特性是同一系统中把同一二进制流读入与写出，其内容没有任何变化。这里区分了文本流和二进制流可以看出它们有诸多不同的地方。其实说白了，文本流人家有样式，穿衣服。进cpu洗澡的时候，要有人脱衣服，出来的时候也有人穿衣服，有人给打扮。而二进制文本就是裸着，出进倒是方便了。文本文件是为人类使用设计的，像你的txt。而二进制的流是计算机使用的，像你编译完的程序。<br /><div style="text-align: center;">&nbsp; &nbsp; &nbsp; &nbsp;<strong>下面我们以图的形式来区分文本流和二进制流 </strong>&nbsp;<br /><div style="text-align: left;"><span style="color: #ff0000;">&nbsp; &nbsp; &nbsp; &nbsp; 文本文件： </span><span style="color: #ff6600;">在磁盘中存放时，每个字符对应一个字节，用于存放相对应的ASCII码。故亦可称作ASCII码文件。</span><span style="color: #333300;"><br /></span><span style="color: #ff0000;">&nbsp;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff6600;">例如：十进制整数5678在文本文件中的存储形式为：</span></div></div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00ffff;"> 00110101 </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00ffff;">00110110 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;00110111 &nbsp; &nbsp; &nbsp;00111000</span> &nbsp; &nbsp;<br /><font class="UNICODE"><span style="font-size: 14pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00ffff; font-size: 36pt;"><strong>&#8595;</strong></span><span style="color: #00ffff;"> &nbsp; </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><span style="color: #00ffff; font-size: 36pt;">&#8595;</span><span style="color: #00ffff; font-size: 18.6667px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #00ffff; font-size: 36pt;">&#8595;</span><span style="color: #00ffff; font-size: 18.6667px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #00ffff; font-size: 36pt;">&#8595;<br /></span><span style="color: #00ffff; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8220;5&#8221; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #00ffff; font-size: 16px;">&#8220;6&#8221; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #00ffff; font-size: 16px;">&#8220;7&#8221; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: #00ffff; font-size: 16px;">&#8220;8&#8221;<br /></span>&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff6600;">文本文件的特点：</span><span style="color: #ff6600;">占存储空间较多，系统需在对数据I/O操作时将5678文本文件存储格式转换为二进制，耗费时间。<br /></span>&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; <span style="color: #ff6600;">&nbsp; 二进制文件：按二进制的编码方式存放文件</span><br /><span style="color: #ff6600;">&nbsp; &nbsp; &nbsp; 示例：十进制整数5678在二进制文件中的存储形式</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00ffff;">0001011000101110<br /><div style="text-align: center;"><strong style="color: #000000;">在IO流中输入输出分为4步：格式化/解析，缓冲，编码转换和传递。</strong></div></span>格式化/解析：在内部数据表示（以字节为单位）与外部数据表示（以字符为单位）之间进行双向转换。例如一个2字节的整数10002，就需要5个字符来表示。<br />缓冲：用于在格式/解析与传递之间缓存字符序列。对于输出，较短的字符序列格式化之后并不马上输出，而是保存在缓冲区里，待积累到一定规模之后再传递到外部设备。相反，从外部设备读入的大量数据也是先放在缓冲区，然后逐步取出完成输入。默认时，IO流的输入输出都是经过缓冲的，也可以将IO流工作在无缓冲模式。<br />编码转换：将一种字符表达式转换成另一种字符表达式。如果格式化产生的字符表达式与外部字符表达式不同（输出时），或则外部表达式与IO流能解析的表达式不同（输入时），就必须进行编码转换。如多字节编码与宽字符编码之间的转换等。多数情况下并不需要编码转换。<br />传递：主要是与外部设备进行通信。输出时，传递负责将经过格式化、缓冲即编码转换后字符序列发送到外部设备；输入时，则负责外部设备抽取数据，为其后进行的编码转换、缓冲及解析提供字符序列。<br /><span style="color: #00ffff; font-size: 36pt;"><br /></span><img src ="http://www.cppblog.com/Liangaixue123/aggbug/214515.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Liangaixue123/" target="_blank">梁川</a> 2016-12-22 08:38 <a href="http://www.cppblog.com/Liangaixue123/archive/2016/12/22/214515.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>