﻿<?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++博客-ljfpudding-文章分类-Programming Tips</title><link>http://www.cppblog.com/ljfpudding/category/3434.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 30 May 2008 08:15:42 GMT</lastBuildDate><pubDate>Fri, 30 May 2008 08:15:42 GMT</pubDate><ttl>60</ttl><item><title>MFC Edit的常用风格</title><link>http://www.cppblog.com/ljfpudding/articles/18800.html</link><dc:creator>JackLi</dc:creator><author>JackLi</author><pubDate>Thu, 15 Feb 2007 07:04:00 GMT</pubDate><guid>http://www.cppblog.com/ljfpudding/articles/18800.html</guid><wfw:comment>http://www.cppblog.com/ljfpudding/comments/18800.html</wfw:comment><comments>http://www.cppblog.com/ljfpudding/articles/18800.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ljfpudding/comments/commentRss/18800.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ljfpudding/services/trackbacks/18800.html</trackback:ping><description><![CDATA[
		<table cellspacing="1" cellpadding="1" width="579" border="1">
				<tbody>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">控件风格</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">含义</font>
												</span>
										</p>
								</td>
						</tr>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">ES_AUTOHSCROLL</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">当用户在行尾键入一个字符时，正文将自动向右滚动10个字符，当用户按回车键时，正文总是滚向左边。</font>
												</span>
										</p>
								</td>
						</tr>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">ES_AUTOVSCROLL</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">当用户在最后一个可见行按回车键时，正文向上滚动一页。</font>
												</span>
										</p>
								</td>
						</tr>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">ES_CENTER</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">在多行编辑框中使正文居中。</font>
												</span>
										</p>
								</td>
						</tr>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">ES_LEFT</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">左对齐正文。</font>
												</span>
										</p>
								</td>
						</tr>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">ES_LOWERCASE</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">把用户输入的字母统统转换成小写字母。</font>
												</span>
										</p>
								</td>
						</tr>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">ES_MULTILINE</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">指定一个多行编辑器。若多行编辑器不指定ES_AUTOHSCROLL风格，则会自动换行，若不指定ES_AUTOVSCROLL，则多行编辑器会在窗口中正文装满时发出警告声响。</font>
												</span>
										</p>
								</td>
						</tr>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">ES_NOHIDESEL</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">缺省时，当编辑框失去输入焦点后会隐藏所选的正文，当获得输入焦点时又显示出来。设置该风格可禁止这种缺省行为。</font>
												</span>
										</p>
								</td>
						</tr>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">ES_OEMCONVERT</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">使编辑框中的正文可以在ANSI字符集和OEM字符集之间相互转换。这在编辑框中包含文件名时是很有用的。</font>
												</span>
										</p>
								</td>
						</tr>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">ES_PASSWORD</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">使所有键入的字符都用“*”来显示。</font>
												</span>
										</p>
								</td>
						</tr>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">ES_RIGHT</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">右对齐正文。</font>
												</span>
										</p>
								</td>
						</tr>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">ES_UPPERCASE</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">把用户输入的字母统统转换成大写字母。</font>
												</span>
										</p>
								</td>
						</tr>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">ES_READONLY</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font size="2">将编辑框设置成只读的。</font>
												</span>
										</p>
								</td>
						</tr>
						<tr>
								<td width="31%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font style="BACKGROUND-COLOR: #ee82ee">
																<font size="2">ES_WANTRETURN</font>
														</font>
												</span>
										</p>
								</td>
								<td width="69%">
										<p align="justify">
												<span style="FONT-SIZE: 9pt">
														<font style="BACKGROUND-COLOR: #ee82ee">
																<font size="2">使多行编辑器接收回车键输入并换行。如果不指定该风格，按回车键会选择缺省的命令按钮，这往往会导致对话框的关闭。</font>
														</font>
												</span>
										</p>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<br />
<img src ="http://www.cppblog.com/ljfpudding/aggbug/18800.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ljfpudding/" target="_blank">JackLi</a> 2007-02-15 15:04 <a href="http://www.cppblog.com/ljfpudding/articles/18800.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>typedef 与 define, 预编译</title><link>http://www.cppblog.com/ljfpudding/articles/18304.html</link><dc:creator>JackLi</dc:creator><author>JackLi</author><pubDate>Sat, 03 Feb 2007 02:28:00 GMT</pubDate><guid>http://www.cppblog.com/ljfpudding/articles/18304.html</guid><wfw:comment>http://www.cppblog.com/ljfpudding/comments/18304.html</wfw:comment><comments>http://www.cppblog.com/ljfpudding/articles/18304.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ljfpudding/comments/commentRss/18304.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ljfpudding/services/trackbacks/18304.html</trackback:ping><description><![CDATA[
		<div>#define DPS  struct *</div>
		<div> </div>
		<div>typedef struct * TPS;</div>
		<div> </div>
		<div>哪个更好呢 显然typedef 更好</div>
		<div> </div>
		<div>如下 DPS d1, d2;</div>
		<div> </div>
		<div> TPS t1, t2;</div>
		<div> </div>
		<div>DPS 只能使 d1为struct *  但是d2却是 struct的</div>
		<div>使用TPS 则毫无问题。</div>
		<div>
				<br />==============================<br /><div>条件编译指令包括</div><div> </div><div>#if,#else,#elif,#endif,#ifdef,#ifndef,#undef</div></div>
<img src ="http://www.cppblog.com/ljfpudding/aggbug/18304.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ljfpudding/" target="_blank">JackLi</a> 2007-02-03 10:28 <a href="http://www.cppblog.com/ljfpudding/articles/18304.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>输入输出流</title><link>http://www.cppblog.com/ljfpudding/articles/18305.html</link><dc:creator>JackLi</dc:creator><author>JackLi</author><pubDate>Sat, 03 Feb 2007 02:28:00 GMT</pubDate><guid>http://www.cppblog.com/ljfpudding/articles/18305.html</guid><wfw:comment>http://www.cppblog.com/ljfpudding/comments/18305.html</wfw:comment><comments>http://www.cppblog.com/ljfpudding/articles/18305.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ljfpudding/comments/commentRss/18305.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ljfpudding/services/trackbacks/18305.html</trackback:ping><description><![CDATA[
		<div>#include &lt;iostream.h&gt;</div>
		<div> </div>
		<div>输入输出流，</div>
		<div>屏幕输入输出 :</div>
		<div>istream</div>
		<div>ostream</div>
		<div> </div>
		<div>stdin, stdout stderr</div>
		<div> </div>
		<div>输出操作符&lt;&lt;</div>
		<div>输入操作符&gt;&gt;</div>
		<div>都可以被重载.</div>
		<div> </div>
		<div>文件输入输出</div>
		<div> </div>
		<div>#include &lt;fstream.h&gt;</div>
		<div>ifstream</div>
		<div>ofstream</div>
		<div> </div>
		<div> </div>
		<div>重载的流函数 来输出复数</div>
		<div> </div>
		<div>class Complex</div>
		<div>{</div>
		<div> </div>
		<div>  friend ostream&amp; operator &lt;&lt; (ostream &amp;os, complex&amp;ob);</div>
		<div> </div>
		<div>};</div>
		<div> </div>
		<div>friend ostream&amp; operator &lt;&lt; (ostream &amp;os, complex&amp;ob)</div>
		<div>{</div>
		<div>   return os&lt;&lt;ob.Re&lt;&lt;(ob.Im&gt;=0.0)?"+":"-"&lt;&lt;fabs(ob.Im)&lt;&lt;"i";</div>
		<div>}</div>
<img src ="http://www.cppblog.com/ljfpudding/aggbug/18305.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ljfpudding/" target="_blank">JackLi</a> 2007-02-03 10:28 <a href="http://www.cppblog.com/ljfpudding/articles/18305.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>运算符重载</title><link>http://www.cppblog.com/ljfpudding/articles/18303.html</link><dc:creator>JackLi</dc:creator><author>JackLi</author><pubDate>Sat, 03 Feb 2007 02:26:00 GMT</pubDate><guid>http://www.cppblog.com/ljfpudding/articles/18303.html</guid><wfw:comment>http://www.cppblog.com/ljfpudding/comments/18303.html</wfw:comment><comments>http://www.cppblog.com/ljfpudding/articles/18303.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ljfpudding/comments/commentRss/18303.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ljfpudding/services/trackbacks/18303.html</trackback:ping><description><![CDATA[
		<div>operator +</div>
		<div>operator ++</div>
		<div> </div>
		<div>For example</div>
		<div> </div>
		<div>RMB operator + (RMB&amp; s1, RMB&amp; s2)</div>
		<div>{</div>
		<div>  unsigned int yuan = s1.yuan+s2.yuan;</div>
		<div>  RMB result(yuan);</div>
		<div>  return result;</div>
		<div>}</div>
		<div> </div>
		<div>RMB&amp; operator ++ (RMB&amp; s )</div>
		<div>{</div>
		<div>   s.yuan++;</div>
		<div>   return s;</div>
		<div>}</div>
		<div> </div>
		<div>区别：  值返回与引用返回</div>
		<div> </div>
		<div> </div>
		<div>运算符做成员函数的方式</div>
		<div> </div>
		<div>RMB RMB::operator + (RMB&amp; s)</div>
		<div>{</div>
		<div>  int nIndex = m_nIndex + s.m_nIndex;</div>
		<div>  RMB temp(nIndex);</div>
		<div>  return temp;</div>
		<div>}</div>
		<div> </div>
		<div>RMB&amp; RMB::operator ++()  //前++</div>
		<div>{</div>
		<div>   m_nIndex++ ;</div>
		<div>   return *this;</div>
		<div>}</div>
		<div> </div>
		<div>RMB RMB::operator ++(int) //后++</div>
		<div>{</div>
		<div>  RMB temp(*this);</div>
		<div>  m_nIndex++;</div>
		<div>  return temp;</div>
		<div>}</div>
		<div> </div>
		<div>RMB&amp; RMB::operator = (RMB&amp; s)</div>
		<div>{</div>
		<div>  m_nIndex = s.m_nIndex;</div>
		<div>  return *this;</div>
		<div>}</div>
<img src ="http://www.cppblog.com/ljfpudding/aggbug/18303.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ljfpudding/" target="_blank">JackLi</a> 2007-02-03 10:26 <a href="http://www.cppblog.com/ljfpudding/articles/18303.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>变量</title><link>http://www.cppblog.com/ljfpudding/articles/18302.html</link><dc:creator>JackLi</dc:creator><author>JackLi</author><pubDate>Sat, 03 Feb 2007 02:22:00 GMT</pubDate><guid>http://www.cppblog.com/ljfpudding/articles/18302.html</guid><wfw:comment>http://www.cppblog.com/ljfpudding/comments/18302.html</wfw:comment><comments>http://www.cppblog.com/ljfpudding/articles/18302.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ljfpudding/comments/commentRss/18302.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ljfpudding/services/trackbacks/18302.html</trackback:ping><description><![CDATA[
		<div>局部变量 与 全局变量</div>
		<div> </div>
		<div>这个很容易理解</div>
		<div> </div>
		<div>函数内部的变量是内部变量也是局部变量，</div>
		<div>函数外部是外部变量是全局变量。</div>
		<div> </div>
		<div>外部变量的声明与外部变量的定义------加extern  定义只有一次， 声明可以多次</div>
		<div> </div>
		<div>外部变量与局部变量的交叉-----------进入函数内部以局部变量为准</div>
		<div> </div>
		<div>外部变量的范围从定义点到文件结束</div>
		<div> </div>
		<div> </div>
		<div>变量的存储类别</div>
		<div> </div>
		<div>静态存储和动态存储</div>
		<div> </div>
		<div> </div>
		<div>用户区包括三个：  程序区，静态区，动态区</div>
		<div> </div>
		<div> </div>
		<div> </div>
		<div>全局变量存储在静态存储区   </div>
		<div> </div>
		<div> </div>
		<div>通常局部变量（非静态），形参，现场保护等。。存储在动态区</div>
		<div> </div>
		<div>变量的存储方法分为两大类 静态存储类，和动态存储类</div>
		<div>具体有 auto, static, register, extern</div>
		<div> </div>
		<div>静态局部变量 static ..----作用局部变量的值在函数调用结束后不消失而是保留原来的值。</div>
		<div> </div>
		<div>静态局部变量在静态区分配内存单元，在整个程序执行期都不释放</div>
		<div> </div>
		<div>静态局部变量是在编译的时候付初值的</div>
		<div> </div>
		<div> </div>
		<div>通常寄存器变量是为了增加程序执行的效率。</div>
		<div> </div>
		<div>变量不能又是静态的又是寄存器变量</div>
		<div> </div>
		<div> </div>
		<div>外部全局变量加上static  限定该变量只能在该文件中使用。</div>
<img src ="http://www.cppblog.com/ljfpudding/aggbug/18302.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ljfpudding/" target="_blank">JackLi</a> 2007-02-03 10:22 <a href="http://www.cppblog.com/ljfpudding/articles/18302.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>BCG中安全使用_variant_t 变量</title><link>http://www.cppblog.com/ljfpudding/articles/17539.html</link><dc:creator>JackLi</dc:creator><author>JackLi</author><pubDate>Thu, 11 Jan 2007 17:40:00 GMT</pubDate><guid>http://www.cppblog.com/ljfpudding/articles/17539.html</guid><wfw:comment>http://www.cppblog.com/ljfpudding/comments/17539.html</wfw:comment><comments>http://www.cppblog.com/ljfpudding/articles/17539.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ljfpudding/comments/commentRss/17539.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ljfpudding/services/trackbacks/17539.html</trackback:ping><description><![CDATA[
		<p>    今天遇到一个_variant_t 变量不能成功转换的BUG，COM组件版本不同会对此有影响。 <br />    char szContent[]={0};<br />    CBCGPGridRow *pRow = m_wndGrid.GetRow(nIndex);<br />    if(pRow)<br />         strcpy(szContent, (_bstr_t)pRow-&gt;GetItem(0)-&gt;GetValue() ); <br />                                           // pRow-&gt;GetItem(0)-&gt;GetValue() 返回const _variant_t &amp;   这段代码在我机器上无任何问题。<br /><br /><br /> 后来发现，  (_bstr_t)pRow-&gt;GetItem(0)-&gt;GetValue()  转换有问题。 <br />   改为  _variant_t var =   pRow-&gt;GetItem(0)-&gt;GetValue() ;<br />   strcpy(szContent,  _com_util::ConvertBSTRToString(var.bstrVal));<br />   OK.</p>
<img src ="http://www.cppblog.com/ljfpudding/aggbug/17539.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ljfpudding/" target="_blank">JackLi</a> 2007-01-12 01:40 <a href="http://www.cppblog.com/ljfpudding/articles/17539.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>