﻿<?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++博客-bullGao</title><link>http://www.cppblog.com/bestgz/</link><description /><language>zh-cn</language><lastBuildDate>Fri, 03 Apr 2026 17:44:47 GMT</lastBuildDate><pubDate>Fri, 03 Apr 2026 17:44:47 GMT</pubDate><ttl>60</ttl><item><title>我的U盘终于复活啦~~！！</title><link>http://www.cppblog.com/bestgz/archive/2006/12/22/16707.html</link><dc:creator>bullGao</dc:creator><author>bullGao</author><pubDate>Thu, 21 Dec 2006 16:53:00 GMT</pubDate><guid>http://www.cppblog.com/bestgz/archive/2006/12/22/16707.html</guid><wfw:comment>http://www.cppblog.com/bestgz/comments/16707.html</wfw:comment><comments>http://www.cppblog.com/bestgz/archive/2006/12/22/16707.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/bestgz/comments/commentRss/16707.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/bestgz/services/trackbacks/16707.html</trackback:ping><description><![CDATA[
		<p>       真是功夫不负有心人，在网上搜索了一个多小时，再加上拿已经坏了的U盘做实验，终于，找到一个非常好用的工具。UMPtool.</p>
		<p>       下面说一下我的经历吧，U盘突然就出问题了，插到电脑里读能读出盘符但是不能打开U盘，提示说没有格式化，但是进行格式化无法完成，到最后的时候就停住了，像死机一样。之前就在网上搜了半天，下了好多个软件试了又试，都不行，还好我没有把U盘扔了，呵呵，今天就把它搞活了~</p>
		<p>       这个工具确实不错，其他的工具都不能读出我的U盘，这个一下就读出来了，让我感到有希望，于是，我就进行了低级格式化，最后~成功，不过有些块坏了，但是能用了，一个心结就这样解开了，嘿嘿。512M的U盘，现在显示的只有463MB了。</p>
		<p>       提供一个下载地址吧，如果遇到同样问题的可以试试，如果不能解决你的问题，那就还得到网上搜啦</p>
		<p>
				<a title="http://www.e-huashun.com/html/Drivers.htm" href="http://www.e-huashun.com/html/Drivers.htm">http://www.e-huashun.com/html/Drivers.htm</a>  <b>芯邦普通芯片量产工具</b></p>
<img src ="http://www.cppblog.com/bestgz/aggbug/16707.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/bestgz/" target="_blank">bullGao</a> 2006-12-22 00:53 <a href="http://www.cppblog.com/bestgz/archive/2006/12/22/16707.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HugeInteger 加减乘法实现</title><link>http://www.cppblog.com/bestgz/archive/2006/12/20/16653.html</link><dc:creator>bullGao</dc:creator><author>bullGao</author><pubDate>Wed, 20 Dec 2006 07:03:00 GMT</pubDate><guid>http://www.cppblog.com/bestgz/archive/2006/12/20/16653.html</guid><wfw:comment>http://www.cppblog.com/bestgz/comments/16653.html</wfw:comment><comments>http://www.cppblog.com/bestgz/archive/2006/12/20/16653.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/bestgz/comments/commentRss/16653.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/bestgz/services/trackbacks/16653.html</trackback:ping><description><![CDATA[
		<p>举例：</p>
		<p>HugeInt.h:</p>
		<p> </p>
		<pre>#ifndef HUGEINT_H
#define HUGEINT_H

#include &lt;iostream&gt;

<span style="COLOR: #0000ff">using</span> std::ostream;

<span style="COLOR: #0000ff">class</span> HugeInt {
	<span style="COLOR: #0000ff">friend</span> ostream &amp;<span style="COLOR: #0000ff">operator</span> &lt;&lt; ( ostream &amp;, <span style="COLOR: #0000ff">const</span> HugeInt &amp; );

<span style="COLOR: #0000ff">public</span>:
	HugeInt( <span style="COLOR: #0000ff">long</span> = 0 );
	HugeInt( <span style="COLOR: #0000ff">const</span><span style="COLOR: #0000ff">char</span> * );

	HugeInt <span style="COLOR: #0000ff">operator</span> + ( <span style="COLOR: #0000ff">const</span> HugeInt &amp; );
	HugeInt <span style="COLOR: #0000ff">operator</span> + ( <span style="COLOR: #0000ff">int</span> );
	HugeInt <span style="COLOR: #0000ff">operator</span> + ( <span style="COLOR: #0000ff">const</span><span style="COLOR: #0000ff">char</span> * );

	HugeInt <span style="COLOR: #0000ff">operator</span> * ( <span style="COLOR: #0000ff">int</span> );
	HugeInt <span style="COLOR: #0000ff">operator</span> * ( <span style="COLOR: #0000ff">const</span> HugeInt &amp; );

<span style="COLOR: #0000ff">private</span>:
	<span style="COLOR: #0000ff">short</span> integer[ 30 ];

};

#endif</pre>
		<p> </p>
		<p>HugeInt.cpp:</p>
		<p> </p>
		<pre>#include &lt;cctype&gt;
#include &lt;cstring&gt;

#include "<span style="COLOR: #8b0000">hugeint.h</span>"

HugeInt::HugeInt( <span style="COLOR: #0000ff">long</span><span style="COLOR: #0000ff">value</span> )
{
	<span style="COLOR: #0000ff">for</span> ( <span style="COLOR: #0000ff">int</span> i = 0; i &lt;= 29; i++ )
		integer[ i ] = 0;

	<span style="COLOR: #0000ff">for</span> ( <span style="COLOR: #0000ff">int</span> j = 29; <span style="COLOR: #0000ff">value</span> != 0 &amp;&amp; j &gt;= 0; j-- ){
		integer[ j ] = <span style="COLOR: #0000ff">value</span> % 10;
		<span style="COLOR: #0000ff">value</span> /= 10;

	}

}

HugeInt::HugeInt( <span style="COLOR: #0000ff">const</span><span style="COLOR: #0000ff">char</span> *<span style="COLOR: #0000ff">string</span> )
{
	<span style="COLOR: #0000ff">for</span> ( <span style="COLOR: #0000ff">int</span> i = 0; i &lt;= 29; i++ )
		integer[ i ] = 0;

	<span style="COLOR: #0000ff">int</span> length = strlen( <span style="COLOR: #0000ff">string</span> );

	<span style="COLOR: #0000ff">for</span> ( <span style="COLOR: #0000ff">int</span> j = 30 - length, k = 0; j &lt;= 29; j++, k++ )

		<span style="COLOR: #0000ff">if</span> ( isdigit( <span style="COLOR: #0000ff">string</span>[ k ] ) )
			integer[ j ] = <span style="COLOR: #0000ff">string</span>[ k ] - '0';

}

HugeInt HugeInt::<span style="COLOR: #0000ff">operator</span> + ( <span style="COLOR: #0000ff">const</span> HugeInt &amp;op2 )
{
	HugeInt temp;
	<span style="COLOR: #0000ff">int</span> carry = 0;

	<span style="COLOR: #0000ff">for</span> ( <span style="COLOR: #0000ff">int</span> i = 29; i &gt;= 0; i-- ){
		temp.integer[ i ] = integer[ i ] + op2.integer[ i ] + carry;

		<span style="COLOR: #0000ff">if</span> ( temp.integer[ i ] &gt; 9 ) {
			temp.integer[ i ] %= 10;
			carry = 1;

		}

		<span style="COLOR: #0000ff">else</span>
			carry = 0;

	}

	<span style="COLOR: #0000ff">return</span> temp;

}

HugeInt HugeInt::<span style="COLOR: #0000ff">operator</span> + ( <span style="COLOR: #0000ff">int</span> op2 )
{
	<span style="COLOR: #0000ff">return</span> *<span style="COLOR: #0000ff">this</span> + HugeInt( op2 );

}

HugeInt HugeInt::<span style="COLOR: #0000ff">operator</span> + ( <span style="COLOR: #0000ff">const</span><span style="COLOR: #0000ff">char</span> *op2 )
{
	<span style="COLOR: #0000ff">return</span> *<span style="COLOR: #0000ff">this</span> + HugeInt( op2 );

}

HugeInt HugeInt::<span style="COLOR: #0000ff">operator</span> * ( <span style="COLOR: #0000ff">const</span> HugeInt &amp;mul )
{
	HugeInt temp;
	HugeInt tempT;
	HugeInt tempN;
	<span style="COLOR: #0000ff">int</span> carry = 0;
	<span style="COLOR: #0000ff">int</span> n = 0;

	<span style="COLOR: #0000ff">for</span> ( <span style="COLOR: #0000ff">int</span> i = 29; i &gt;= 0; i-- ){
		
		<span style="COLOR: #0000ff">for</span> ( <span style="COLOR: #0000ff">int</span> t = 0; t &lt;= 29; t++ ){
			tempT.integer[ t ] = 0;
			tempN.integer[ t ] = 0;

		}

		<span style="COLOR: #0000ff">for</span> ( <span style="COLOR: #0000ff">int</span> j = 29; j &gt;= 0; j-- ){
			tempT.integer[ j ] = integer[ j ] * mul.integer[ i ] + carry;

			<span style="COLOR: #0000ff">if</span> ( tempT.integer[ j ] &gt; 9 ){
				carry = tempT.integer[ j ] / 10;
				tempT.integer[ j ] %= 10;				

			}

 			<span style="COLOR: #0000ff">else</span>
				carry = 0;

		}
		
		<span style="COLOR: #0000ff">for</span> ( <span style="COLOR: #0000ff">int</span> y = 29; y &gt;= 0; y-- )
			tempN.integer[ y - n ] = tempT.integer[ y ];

		++n;

		temp = temp + tempN;

	}

	<span style="COLOR: #0000ff">return</span> temp;

}

HugeInt HugeInt::<span style="COLOR: #0000ff">operator</span> * ( <span style="COLOR: #0000ff">int</span> mul )
{
	<span style="COLOR: #0000ff">return</span> *<span style="COLOR: #0000ff">this</span> * HugeInt( mul );

}

ostream &amp;<span style="COLOR: #0000ff">operator</span> &lt;&lt; ( ostream &amp;output, <span style="COLOR: #0000ff">const</span> HugeInt &amp;num )
{
	<span style="COLOR: #0000ff">int</span> i;

	<span style="COLOR: #0000ff">for</span> ( i = 0; ( num.integer[ i ] == 0 ) &amp;&amp; ( i &lt;= 29 ); i++ )
		;

	<span style="COLOR: #0000ff">if</span> ( i == 30 )
		output &lt;&lt; 0;
	<span style="COLOR: #0000ff">else</span><span style="COLOR: #0000ff">for</span> ( ; i &lt;= 29; i++ )
			output &lt;&lt; num.integer[ i ];

	<span style="COLOR: #0000ff">return</span> output;

}</pre>
		<p> </p>
		<p>main.cpp:</p>
		<p> </p>
		<pre>#include &lt;iostream&gt;

<span style="COLOR: #0000ff">using</span> std::cout;
<span style="COLOR: #0000ff">using</span> std::endl;

#include "<span style="COLOR: #8b0000">hugeint1.h</span>"

<span style="COLOR: #0000ff">int</span> main()
{
	HugeInt n1( 7654321 );
	HugeInt n2( 7891234 );
	HugeInt n3( "<span style="COLOR: #8b0000">9999999999999999999999999</span>" );
	HugeInt n4( "<span style="COLOR: #8b0000">1</span>" );
	HugeInt n5;
	HugeInt n6( 1234 );
	HugeInt n7( 3478 );

	cout &lt;&lt; "<span style="COLOR: #8b0000">n1 is </span>" &lt;&lt; n1 &lt;&lt; "<span style="COLOR: #8b0000">\nn2 is </span>" &lt;&lt; n2
		 &lt;&lt; "<span style="COLOR: #8b0000">\nn3 is </span>" &lt;&lt; n3 &lt;&lt; "<span style="COLOR: #8b0000">\nn4 is </span>" &lt;&lt; n4
		 &lt;&lt; "<span style="COLOR: #8b0000">\nn5 is </span>" &lt;&lt; n5 &lt;&lt; "<span style="COLOR: #8b0000">\nn6 is </span>" &lt;&lt; n6
		 &lt;&lt; "<span style="COLOR: #8b0000">\nn7 is </span>" &lt;&lt; n7 &lt;&lt; "<span style="COLOR: #8b0000">\n\n</span>";

	n5 = n1 + n2;
	cout &lt;&lt; n1 &lt;&lt; "<span style="COLOR: #8b0000"> + </span>" &lt;&lt; n2 &lt;&lt; "<span style="COLOR: #8b0000"> = </span>" &lt;&lt; n5 &lt;&lt; "<span style="COLOR: #8b0000">\n\n</span>";

	cout &lt;&lt; n3 &lt;&lt; "<span style="COLOR: #8b0000"> + </span>" &lt;&lt; n4 &lt;&lt; "<span style="COLOR: #8b0000">\n= </span>" &lt;&lt; ( n3 + n4 )
		 &lt;&lt; "<span style="COLOR: #8b0000">\n\n</span>";

	n5 = n1 + 9;
	cout &lt;&lt; n1 &lt;&lt; "<span style="COLOR: #8b0000"> + </span>" &lt;&lt; 9 &lt;&lt; "<span style="COLOR: #8b0000"> = </span>" &lt;&lt; n5 &lt;&lt; "<span style="COLOR: #8b0000">\n\n</span>";

	n5 = n2 + "<span style="COLOR: #8b0000">10000</span>";
	cout &lt;&lt; n2 &lt;&lt; "<span style="COLOR: #8b0000"> + </span>" &lt;&lt; "<span style="COLOR: #8b0000">10000</span>" &lt;&lt; "<span style="COLOR: #8b0000"> = </span>" &lt;&lt; n5 &lt;&lt; endl;

	n5 = n7 * n6;
	cout &lt;&lt; n7 &lt;&lt; "<span style="COLOR: #8b0000"> * </span>" &lt;&lt; n6 &lt;&lt; "<span style="COLOR: #8b0000"> = </span>" &lt;&lt; n5 &lt;&lt; endl;

	<span style="COLOR: #0000ff">return</span> 0;

}</pre>
		<p> </p>
		<p>输出结果为：<br /><img height="203" alt="{1586B489-88E0-4FE4-A107-B2A2CB761E60}0.jpg" src="http://www.cppblog.com/images/cppblog_com/bestgz/%7B1586B489-88E0-4FE4-A107-B2A2CB761E60%7D0.jpg" width="222" border="0" /></p>
<img src ="http://www.cppblog.com/bestgz/aggbug/16653.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/bestgz/" target="_blank">bullGao</a> 2006-12-20 15:03 <a href="http://www.cppblog.com/bestgz/archive/2006/12/20/16653.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>作业 HugeInteger 运算符 * 重载  完成结果记录</title><link>http://www.cppblog.com/bestgz/archive/2006/12/20/16651.html</link><dc:creator>bullGao</dc:creator><author>bullGao</author><pubDate>Wed, 20 Dec 2006 06:53:00 GMT</pubDate><guid>http://www.cppblog.com/bestgz/archive/2006/12/20/16651.html</guid><wfw:comment>http://www.cppblog.com/bestgz/comments/16651.html</wfw:comment><comments>http://www.cppblog.com/bestgz/archive/2006/12/20/16651.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/bestgz/comments/commentRss/16651.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/bestgz/services/trackbacks/16651.html</trackback:ping><description><![CDATA[
		<p>
		</p>
		<p> </p>
		<pre>HugeInt HugeInt::<span style="COLOR: #0000ff">operator</span> * ( <span style="COLOR: #0000ff">const</span> HugeInt &amp;mul )
{
	HugeInt temp;
	HugeInt tempT;
	HugeInt tempN;
	<span style="COLOR: #0000ff">int</span> carry = 0;
	<span style="COLOR: #0000ff">int</span> n = 0;

	<span style="COLOR: #0000ff">for</span> ( <span style="COLOR: #0000ff">int</span> i = 29; i &gt;= 0; i-- ){
		
		<span style="COLOR: #0000ff">for</span> ( <span style="COLOR: #0000ff">int</span> t = 0; t &lt;= 29; t++ ){
			tempT.integer[ t ] = 0;
			tempN.integer[ t ] = 0;

		}

		<span style="COLOR: #0000ff">for</span> ( <span style="COLOR: #0000ff">int</span> j = 29; j &gt;= 0; j-- ){
			tempT.integer[ j ] = integer[ j ] * mul.integer[ i ] + carry;

			<span style="COLOR: #0000ff">if</span> ( tempT.integer[ j ] &gt; 9 ){
				carry = tempT.integer[ j ] / 10;
				tempT.integer[ j ] %= 10;				

			}

 			<span style="COLOR: #0000ff">else</span>
				carry = 0;

		}
		
		<span style="COLOR: #0000ff">for</span> ( <span style="COLOR: #0000ff">int</span> y = 29; y &gt;= 0; y-- )            <font color="#008000">// 移位处理</font>
			tempN.integer[ y - n ] = tempT.integer[ y ];

		++n;

		temp = temp + tempN;

	}

	<span style="COLOR: #0000ff">return</span> temp;

}</pre>
		<p> </p>
		<p>       考虑到乘法运算，比如12 * 34，那么4先和12做乘法，然后3和12做乘法，之后两数相加得出结果，但是需要注意的是：3与12的乘积要左移一位后再与4和12的乘积做加法。依此类推，推之更大的数。</p>
		<p>       主要是这个移位处理，费了我好多时间，终于搞定了~</p>
<img src ="http://www.cppblog.com/bestgz/aggbug/16651.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/bestgz/" target="_blank">bullGao</a> 2006-12-20 14:53 <a href="http://www.cppblog.com/bestgz/archive/2006/12/20/16651.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>消息循环</title><link>http://www.cppblog.com/bestgz/archive/2006/12/11/16270.html</link><dc:creator>bullGao</dc:creator><author>bullGao</author><pubDate>Mon, 11 Dec 2006 07:00:00 GMT</pubDate><guid>http://www.cppblog.com/bestgz/archive/2006/12/11/16270.html</guid><wfw:comment>http://www.cppblog.com/bestgz/comments/16270.html</wfw:comment><comments>http://www.cppblog.com/bestgz/archive/2006/12/11/16270.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/bestgz/comments/commentRss/16270.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/bestgz/services/trackbacks/16270.html</trackback:ping><description><![CDATA[
		<p>Windows应用程序的运行以消息为核心，Windows将产生的消息放入应用程序的消息队列中，而应用程序WinMain函数的消息循环提取队列中的消息，并将信息传给窗口函数的相应过程。</p>
		<p>消息循环的常见格式如下：</p>
		<p>MSG Msg;</p>
		<p>...</p>
		<p>while ( GetMessage( &amp;Msg, NULL, 0, 0 ) )</p>
		<blockquote>
				<p>{</p>
				<p>TranslateMessage( &amp;Msg );</p>
				<p>DispatchMessage( &amp;Msg );</p>
				<p>}</p>
		</blockquote>
		<p>其中函数GetMessage的作用是从消息队列中读取一条信息，并将信息放在一个MSG结构中，其形式为：</p>
		<p>GetMassage</p>
		<blockquote>
				<p>( lpMSG, </p>
				<p>  hwnd,</p>
				<p>  nMsgFilterMin,</p>
				<p>  nMsgFilterMax</p>
				<p>)</p>
		</blockquote>
		<p>值得注意的是，GetMessage函数中的参数nMsgFilterMin和nMsgFilterMax可实现对消息的过滤，即程序仅处理所确定的消息号范围内的消息，如果两个参数都为0，则不过滤消息。</p>
		<p>TranslateMessag函数负责将消息的虚拟间转换为字符信息，其形式为：</p>
		<p>TranslateMessage( lpMSG )</p>
		<p>DispatchMessage函数将参数lpMSG指向的消息传送到指定窗口函数，其形式为：</p>
		<p>DispatchMessage( lpMSG )</p>
		<p>当GetMessage函数返回零值，检索到WM_QUIT时，程序将结束循环并退出。</p>
<img src ="http://www.cppblog.com/bestgz/aggbug/16270.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/bestgz/" target="_blank">bullGao</a> 2006-12-11 15:00 <a href="http://www.cppblog.com/bestgz/archive/2006/12/11/16270.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>面向对象程序设计中的一些复杂数据结构</title><link>http://www.cppblog.com/bestgz/archive/2006/12/11/16267.html</link><dc:creator>bullGao</dc:creator><author>bullGao</author><pubDate>Mon, 11 Dec 2006 06:34:00 GMT</pubDate><guid>http://www.cppblog.com/bestgz/archive/2006/12/11/16267.html</guid><wfw:comment>http://www.cppblog.com/bestgz/comments/16267.html</wfw:comment><comments>http://www.cppblog.com/bestgz/archive/2006/12/11/16267.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/bestgz/comments/commentRss/16267.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/bestgz/services/trackbacks/16267.html</trackback:ping><description><![CDATA[
		<p>
		</p>
		<h1>
				<span style="COLOR: #0000ff">
						<font color="#000000">WNDCLASS</font>
				</span>
		</h1>
		<pre>
				<span style="COLOR: #0000ff">typedef </span>
				<font color="#0000ff">struc<span style="COLOR: #0000ff">t</span></font> _WNDCLASS { 
    UINT    style; 		<span style="COLOR: #008000">//窗口类样式</span>
    WNDPROC lpfnWndProc; 	<span style="COLOR: #008000">//指向窗口函数的指针</span><span style="COLOR: #0000ff">int</span>     cbClsExtra; 	<span style="COLOR: #008000">//分配在窗口类结构后的字节数</span><span style="COLOR: #0000ff">int</span>     cbWndExtra; 	<span style="COLOR: #008000">//分配在窗口实例后的字节数</span>
    HANDLE  hInstance; 		<span style="COLOR: #008000">//定义窗口类的应用程序的实力句柄</span>
    HICON   hIcon; 		<span style="COLOR: #008000">//窗口类的图标</span>
    HCURSOR hCursor; 		<span style="COLOR: #008000">//窗口类的光标</span>
    HBRUSH  hbrBackground; 	<span style="COLOR: #008000">//窗口类的背景刷</span>
    LPCTSTR lpszMenuName; 	<span style="COLOR: #008000">//窗口类菜单资源</span>
    LPCTSTR lpszClassName; 	<span style="COLOR: #008000">//窗口类名</span>
} WNDCLASS; </pre>
		<pre> </pre>
		<pre> </pre>
		<h3>Members</h3>
		<dl>
				<dt>
						<b>style</b>
				</dt>
				<dd>Specifies the class style(s). Styles can be combined by using the bitwise OR (|) operator. This member can be any combination of the following values: 
<p><b>Value</b><br />Action </p><p>CS_BYTEALIGNCLIENT<br />Aligns the window's client area on the byte boundary (in the x direction). This style affects the width of the window and its horizontal position on the display. </p><p>CS_BYTEALIGNWINDOW<br />Aligns a window on a byte boundary (in the x direction). This style affects the width of the window and its horizontal position on the display. </p><p>CS_CLASSDC<br />Allocates one device context to be shared by all windows in the class. Because window classes are process specific, it is possible for multiple threads of an application to create a window of the same class. It is also possible for the threads to attempt to use the device context simultaneously. When this happens, the system allows only one thread to successfully finish its drawing operation. For more information, see <a href="JavaScript:alink_1.Click()">Device Contexts</a>. </p><p>CS_DBLCLKS<br />Sends double-click messages to the window procedure when the user double-clicks the mouse while the cursor is within a window belonging to the class. </p><p>CS_GLOBALCLASS<br />Allows an application to create a window of the class regardless of the value of the <i>hInstance</i> parameter passed to the <a href="windows_33jr.htm"><b>CreateWindow</b></a> or <a href="windows_1w6w.htm"><b>CreateWindowEx</b></a> function. If you do not specify this style, the <i>hInstance</i> parameter passed to the <b>CreateWindow</b> (or <b>CreateWindowEx</b>) function must be the same as the <i>hInstance</i> parameter passed to the <a href="winclass_70s3.htm"><b>RegisterClass</b></a> function. </p><p>You can create a global class by creating the window class in a dynamic-link library (DLL) and listing the name of the DLL in the registry under the following keys: </p><p><b>HKEY_LOCAL_MACHINE</b>\<b>Software<br /></b>\<b>Microsoft</b>\<b>Windows NT</b>\<br /><b>CurrentVersion</b>\<b>Windows</b>\<b>AppInit_DLLs</b></p><p>Whenever a process starts, the system loads the specified DLLs in the context of the newly started process before calling the entry-point function in that process. The DLL must register the class during its initialization procedure and must specify the CS_GLOBALCLASS style. </p><p>CS_HREDRAW<br />Redraws the entire window if a movement or size adjustment changes the width of the client area. </p><p>CS_NOCLOSE<br />Disables <b>Close</b> on the <b>window</b> menu. </p><p>CS_OWNDC<br />Allocates a unique device context for each window in the class. </p><p>CS_PARENTDC<br />Sets the clipping region of the child window to that of the parent window so that the child can draw on the parent. A window with the CS_PARENTDC style bit receives a regular device context from the system's cache of device contexts. It does not give the child the parent's device context or device context settings. Specifying CS_PARENTDC enhances an application's performance. For more information, see <a href="JavaScript:alink_2.Click()">Device Contexts</a>. </p><p>CS_SAVEBITS<br />Saves, as a bitmap, the portion of the screen image obscured by a window. The system uses the saved bitmap to re-create the screen image when the window is removed. The system displays the bitmap at its original location and does not send <a href="JavaScript:alink_3.Click()">WM_PAINT</a> messages to windows obscured by the window if the memory used by the bitmap has not been discarded and if other screen actions have not invalidated the stored image. This style is useful for small windows (for example, menus or dialog boxes) that are displayed briefly and then removed before other screen activity takes place. This style increases the time required to display the window, because the system must first allocate memory to store the bitmap. </p><p>CS_VREDRAW<br />Redraws the entire window if a movement or size adjustment changes the height of the client area. </p><p></p></dd>
				<dt>
						<b>lpfnWndProc</b>
				</dt>
				<dd>Pointer to the window procedure. You must use the <a href="winprocs_9dlv.htm"><b>CallWindowProc</b></a> function to call the window procedure. For more information, see <a href="winprocs_53xf.htm"><b>WindowProc</b></a>. 
</dd>
				<dt>
						<b>cbClsExtra</b>
				</dt>
				<dd>Specifies the number of extra bytes to allocate following the window-class structure. The system initializes the bytes to zero. 
</dd>
				<dt>
						<b>cbWndExtra</b>
				</dt>
				<dd>Specifies the number of extra bytes to allocate following the window instance. The system initializes the bytes to zero. If an application uses <b>WNDCLASS</b> to register a dialog box created by using the <b>CLASS</b> directive in the resource file, it must set this member to DLGWINDOWEXTRA. 
</dd>
				<dt>
						<b>hInstance</b>
				</dt>
				<dd>Handle to the instance that the window procedure of this class is within. 
</dd>
				<dt>
						<b>hIcon</b>
				</dt>
				<dd>Handle to the class icon. This member must be a handle of an icon resource. If this member is NULL, an application must draw an icon whenever the user minimizes the application's window. 
</dd>
				<dt>
						<b>hCursor</b>
				</dt>
				<dd>Handle to the class cursor. This member must be a handle of a cursor resource. If this member is NULL, an application must explicitly set the cursor shape whenever the mouse moves into the application's window. 
</dd>
				<dt>
						<b>hbrBackground</b>
				</dt>
				<dd>Handle to the class background brush. This member can be a handle to the physical brush to be used for painting the background, or it can be a color value. A color value must be one of the following standard system colors (the value 1 must be added to the chosen color). If a color value is given, you must convert it to one of the following <b>HBRUSH</b> types: 
<p>COLOR_ACTIVEBORDER<br />COLOR_ACTIVECAPTION<br />COLOR_APPWORKSPACE<br />COLOR_BACKGROUND<br />COLOR_BTNFACE<br />COLOR_BTNSHADOW<br />COLOR_BTNTEXT<br />COLOR_CAPTIONTEXT<br />COLOR_GRAYTEXT<br />COLOR_HIGHLIGHT<br />COLOR_HIGHLIGHTTEXT<br />COLOR_INACTIVEBORDER<br />COLOR_INACTIVECAPTION<br />COLOR_MENU<br />COLOR_MENUTEXT<br />COLOR_SCROLLBAR<br />COLOR_WINDOW<br />COLOR_WINDOWFRAME<br />COLOR_WINDOWTEXT </p><p>The system automatically deletes class background brushes when the class is freed. An application should not delete these brushes, because a class may be used by multiple instances of an application. </p><p>When this member is NULL, an application must paint its own background whenever it is requested to paint in its client area. To determine whether the background must be painted, an application can either process the WM_ERASEBKGND message or test the <b>fErase</b> member of the <a href="JavaScript:alink_4.Click()"><b>PAINTSTRUCT</b></a> structure filled by the <a href="JavaScript:alink_5.Click()"><b>BeginPaint</b></a> function. </p><p></p></dd>
				<dt>
						<b>lpszMenuName</b>
				</dt>
				<dd>Pointer to a null-terminated character string that specifies the resource name of the class menu, as the name appears in the resource file. If you use an integer to identify the menu, use the <a href="resource_2dd1.htm"><b>MAKEINTRESOURCE</b></a> macro. If this member is NULL, windows belonging to this class have no default menu. 
</dd>
				<dt>
						<b>lpszClassName</b>
				</dt>
				<dd>Pointer to a null-terminated string or is an atom. If this parameter is an atom, it must be a global atom created by a previous call to the <b>GlobalAddAtom</b> function. The atom, a 16-bit value, must be in the low-order word of <b>lpszClassName</b>; the high-order word must be zero. 
<p>If <b>lpszClassName</b> is a string, it specifies the window class name. </p></dd>
		</dl>
		<p>
		</p>
		<h2>MSG</h2>
		<p>The <b>MSG</b> structure contains message information from a thread's message queue. </p>
		<p> </p>
		<pre>
				<span style="COLOR: #0000ff">typedef </span>
				<span style="COLOR: #0000ff">struct</span> tagMSG {     <span style="COLOR: #008000">// msg </span>
    HWND   hwnd;     
    UINT   message; 
    WPARAM wParam; 
    LPARAM lParam; 
    DWORD  time; 
    POINT  pt; 
} MSG;</pre>
		<p>
		</p>
		<h3>Members</h3>
		<dl>
				<dt>
						<b>hwnd</b>
				</dt>
				<dd>Handle to the window whose window procedure receives the message. 
</dd>
				<dt>
						<b>message</b>
				</dt>
				<dd>Specifies the message number. 
</dd>
				<dt>
						<b>wParam</b>
				</dt>
				<dd>Specifies additional information about the message. The exact meaning depends on the value of the <b>message</b> member. 
</dd>
				<dt>
						<b>lParam</b>
				</dt>
				<dd>Specifies additional information about the message. The exact meaning depends on the value of the <b>message</b> member. 
</dd>
				<dt>
						<b>time</b>
				</dt>
				<dd>Specifies the time at which the message was posted. 
</dd>
				<dt>
						<b>pt</b>
				</dt>
				<dd>Specifies the cursor position, in screen coordinates, when the message was posted. </dd>
		</dl>
		<p> </p>
		<p> </p>
		<h2>
				<a>
				</a>POINT Structure</h2>
		<p>The <b>POINT</b> data structure has the following form: </p>
		<p> </p>
		<pre>
				<span style="COLOR: #0000ff">typedef</span>
				<span style="COLOR: #0000ff">struct</span> tagPOINT {
   LONG x;
   LONG y;
} POINT;
</pre>
		<p>
		</p>
		<p>The <b>POINT</b> structure defines the x<i>-</i> and y-coordinates of a point. </p>
		<p>
				<b>Members</b>
		</p>
		<p>
				<b>x</b>
		</p>
		<p>Specifies the x-coordinate of a point. </p>
		<p>
				<b>y</b>
		</p>
		<p>Specifies the y-coordinate of a point. </p>
		<p>
		</p>
		<p>
		</p>
		<h2>
				<a>
				</a>
				<sup>
				</sup>RECT Structure</h2>
		<p>The <b>RECT</b> data structure has the following form: </p>
		<p> </p>
		<pre>
				<span style="COLOR: #0000ff">typedef</span>
				<span style="COLOR: #0000ff">struct</span> tagRECT {
   LONG left;
   LONG top;
   LONG right;
   LONG bottom;
} RECT;
</pre>
		<p>
		</p>
		<p>The <b>RECT</b> structure defines the coordinates of the upper-left and lower-right corners of a rectangle. </p>
		<h3>
				<b>Members</b>
		</h3>
		<p>
				<b>left</b>
		</p>
		<p>Specifies the x-coordinate of the upper-left corner of a rectangle. </p>
		<p>
				<b>top</b>
		</p>
		<p>Specifies the y-coordinate of the upper-left corner of a rectangle. </p>
		<p>
				<b>right</b>
		</p>
		<p>Specifies the x-coordinate of the lower-right corner of a rectangle. </p>
		<p>
				<b>bottom</b>
		</p>
		<p>Specifies the y-coordinate of the lower-right corner of a rectangle.</p>
<img src ="http://www.cppblog.com/bestgz/aggbug/16267.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/bestgz/" target="_blank">bullGao</a> 2006-12-11 14:34 <a href="http://www.cppblog.com/bestgz/archive/2006/12/11/16267.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>common data types in MFC</title><link>http://www.cppblog.com/bestgz/archive/2006/12/11/16259.html</link><dc:creator>bullGao</dc:creator><author>bullGao</author><pubDate>Sun, 10 Dec 2006 18:50:00 GMT</pubDate><guid>http://www.cppblog.com/bestgz/archive/2006/12/11/16259.html</guid><wfw:comment>http://www.cppblog.com/bestgz/comments/16259.html</wfw:comment><comments>http://www.cppblog.com/bestgz/archive/2006/12/11/16259.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/bestgz/comments/commentRss/16259.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/bestgz/services/trackbacks/16259.html</trackback:ping><description><![CDATA[
		<p>
		</p>
		<h3>
				<a>
				</a>Data Types</h3>
		<p>This topic lists the data types most commonly used in the Microsoft Foundation Class Library. Most of the data types are exactly the same as those in the Windows Software Development Kit (SDK), while others are unique to MFC. 
</p>
		<p>Commonly used Windows SDK and MFC data types are as follows: 
</p>
		<ul>
				<li>
						<b>BOOL</b>   A Boolean value. 
</li>
				<li>
						<b>BSTR</b>   A 32-bit character pointer. 
</li>
				<li>
						<b>BYTE</b>   An 8-bit integer that is not signed. 
</li>
				<li>
						<b>COLORREF</b>   A 32-bit value used as a color value. 
</li>
				<li>
						<b>DWORD</b>   A 32-bit unsigned integer or the address of a segment and its associated offset. 
</li>
				<li>
						<b>LONG</b>   A 32-bit signed integer. 
</li>
				<li>
						<b>LPARAM</b>   A 32-bit value passed as a parameter to a window procedure or callback function. 
</li>
				<li>
						<b>LPCSTR</b>   A 32-bit pointer to a constant character string. 
</li>
				<li>
						<b>LPSTR</b>   A 32-bit pointer to a character string. 
</li>
				<li>
						<b>LPCTSTR</b>   A 32-bit pointer to a constant character string that is portable for Unicode and DBCS. 
</li>
				<li>
						<b>LPTSTR</b>   A 32-bit pointer to a character string that is portable for Unicode and DBCS. 
</li>
				<li>
						<b>LPVOID</b>   A 32-bit pointer to an unspecified type. 
</li>
				<li>
						<b>LRESULT</b>   A 32-bit value returned from a window procedure or callback function. 
</li>
				<li>
						<b>UINT</b>   A 16-bit unsigned integer on Windows versions 3.0 and 3.1; a 32-bit unsigned integer on Win32. 
</li>
				<li>
						<b>WNDPROC</b>   A 32-bit pointer to a window procedure. 
</li>
				<li>
						<b>WORD</b>   A 16-bit unsigned integer. 
</li>
				<li>
						<b>WPARAM</b>   A value passed as a parameter to a window procedure or callback function: 16 bits on Windows versions 3.0 and 3.1; 32 bits on Win32. </li>
		</ul>
		<p>Data types unique to the Microsoft Foundation Class Library include the following: 
</p>
		<ul>
				<li>
						<b>POSITION</b>   A value used to denote the position of an element in a collection; used by MFC collection classes. 
</li>
				<li>
						<b>LPCRECT</b>   A 32-bit pointer to a constant (nonmodifiable) <b>RECT</b> structure. </li>
		</ul>
<img src ="http://www.cppblog.com/bestgz/aggbug/16259.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/bestgz/" target="_blank">bullGao</a> 2006-12-11 02:50 <a href="http://www.cppblog.com/bestgz/archive/2006/12/11/16259.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Keyword typedef</title><link>http://www.cppblog.com/bestgz/archive/2006/12/10/16249.html</link><dc:creator>bullGao</dc:creator><author>bullGao</author><pubDate>Sun, 10 Dec 2006 15:08:00 GMT</pubDate><guid>http://www.cppblog.com/bestgz/archive/2006/12/10/16249.html</guid><wfw:comment>http://www.cppblog.com/bestgz/comments/16249.html</wfw:comment><comments>http://www.cppblog.com/bestgz/archive/2006/12/10/16249.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/bestgz/comments/commentRss/16249.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/bestgz/services/trackbacks/16249.html</trackback:ping><description><![CDATA[
		<p>
		</p>
		<h3>
				<a>
				</a>
				<sup>
				</sup>typedef</h3>
		<p>
				<b>typedef</b>
				<i>type-declaration synonym</i>
				<b>;</b>
		</p>
		<p>The <b>typedef</b> keyword defines a synonym for the specified <i>type-declaration</i>. The identifier in the <i>type-declaration</i> becomes another name for the type, instead of naming an instance of the type. You cannot use the <b>typedef</b> specifier inside a function definition. </p>
		<p>A <b>typedef</b> declaration introduces a name that, within its scope, becomes a synonym for the type given by the <i>decl</i>-<i>specifiers</i> portion of the declaration. In contrast to the <b>class</b>, <b>struct</b>, <b>union</b>, and <b>enum</b> declarations, <b>typedef</b> declarations do not introduce new types — <u>they introduce new names for existing types</u>. </p>
		<p>
				<b>Example</b>
				<br />
				<br />
		</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> Example of the typedef keyword</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">typedef unsigned </span>
				<span style="COLOR: #0000ff">long</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">ulong</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">ulong</span>
				<span style="COLOR: #000000"> ul;     </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> Equivalent to "unsigned long ul;"</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />typedef </span>
				<span style="COLOR: #0000ff">struct</span>
				<span style="COLOR: #000000"> mystructtag<br /><img id="Codehighlighter1_143_181_Open_Image" onclick="this.style.display='none'; Codehighlighter1_143_181_Open_Text.style.display='none'; Codehighlighter1_143_181_Closed_Image.style.display='inline'; Codehighlighter1_143_181_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_143_181_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_143_181_Closed_Text.style.display='none'; Codehighlighter1_143_181_Open_Image.style.display='inline'; Codehighlighter1_143_181_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_143_181_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_143_181_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000">   i;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   </span>
						<span style="COLOR: #0000ff">float</span>
						<span style="COLOR: #000000"> f;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   </span>
						<span style="COLOR: #0000ff">char</span>
						<span style="COLOR: #000000">  c;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000"> mystruct;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />mystruct ms;   </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> Equivalent to "struct mystructtag ms;"</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />typedef </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> (</span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000">funcptr)();  </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> funcptr is synonym for "pointer<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />                           </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">    to function returning int"</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />funcptr table[</span>
				<span style="COLOR: #000000">10</span>
				<span style="COLOR: #000000">];   </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> Equivalent to "int (*table[10])();"<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
		</div>
<img src ="http://www.cppblog.com/bestgz/aggbug/16249.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/bestgz/" target="_blank">bullGao</a> 2006-12-10 23:08 <a href="http://www.cppblog.com/bestgz/archive/2006/12/10/16249.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Windows编程知识入门</title><link>http://www.cppblog.com/bestgz/archive/2006/12/10/16233.html</link><dc:creator>bullGao</dc:creator><author>bullGao</author><pubDate>Sun, 10 Dec 2006 09:40:00 GMT</pubDate><guid>http://www.cppblog.com/bestgz/archive/2006/12/10/16233.html</guid><wfw:comment>http://www.cppblog.com/bestgz/comments/16233.html</wfw:comment><comments>http://www.cppblog.com/bestgz/archive/2006/12/10/16233.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/bestgz/comments/commentRss/16233.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/bestgz/services/trackbacks/16233.html</trackback:ping><description><![CDATA[
		<p dir="ltr" style="MARGIN-RIGHT: 0px">
				<font color="#ff0000">窗口</font>的概念：<br />      窗口是Windows应用程序的基本操作单元，是系统管理应用程序的基本单元，是应用程序与用户之间交互的接口环境。应用程序的运行过程是窗口内部、窗口与窗口之间、窗口与系统之间进行数据处理与数据交换的过程。因此，编写Windows应用程序首先应创建一个或多个窗口。<br />      一个应用程序的窗口一般包括窗口边界、工作区、控制菜单框、控制菜单、水平垂直滚动条以及最大化按钮、最小化按钮和标题栏等对象。<br /><br /><br /><font color="#ff0000">事件驱动</font>的概念：<br />      Windows程序设计围绕着事件或消息的产生驱动运行消息处理函数。所谓<font color="#000000"><font color="#9acd32">消息</font>是描述事件发生的信息</font>。例如按下键盘上的某一个键时，系统就会产生一条特定的消息，标识案件事件的发生，这里的事件包含按下键的消息、字符消息和键的弹起消息。Windows程序的执行顺序取决于事件发生的顺序，程序执行顺序是由顺序产生的消息驱动的，但是消息产生往往并不要求有次序之分。程序员可以针对消息类型编写消息处理程序已处理接收的消息，或者发出其他消息以驱动其他处理程序，但是不必预先确定消息产生的次序。这是面向对象编成的最显著特点，也是与传统面向过程编程方法的重要区别之一。<br />      事件驱动编程方法对于编写交互式程序很有用处，用这一方法编写的程序使程序避免了死板的操作模式，从而使用户能够按照自己的意愿采用灵活多变的操作形式。<br /><br /><br /><font color="#ff0000">句柄</font><font color="#000000">：<br /></font>      句柄（handle）是<u>windows编程的基础</u>，它是一个<font color="#9acd32">4字节长</font>的整数值，用于标识应用程序中不同的对象和同类对象中不同的实例，诸如一个窗口、按钮、图表、滚动条、输出设备、控制或文件等对象，都需要一个唯一的句柄来标识，应用程序通过句柄来访问相应的对象信息。<br />      在Windows应用程序中，句柄的使用是很频繁的。部分常用句柄类型：<br />      HWND   标识窗口句柄<br />      HINSTANCE   标识当前实例句柄<br />      HCURSOR   标识光标句柄<br />      HFONT   标识字体句柄<br />      HPEN   标识画笔句柄<br />      HBRUSH   标识画刷句柄<br />      HDC   标识设备环境句柄<br />      HBITMAP   标识位图句柄<br />      HICON   标识图标句柄<br />      HMENU   标识菜单句柄<br />      HFILE   标识文件句柄<br /><br />Windows应用程序利用Windows消息（Message）与其他Windows应用程序及Windows系统进行信息交换。Windows中消息由三部分<font color="#ff0000">组成</font>：<u>消息号、字参数和长字参数</u>。<br />   消息号是事先定义好的消息名标识；字参数（wParam）和长字参数（lParam）用于提供消息的附加信息，附加信息的含义与具体消息号有关。Windows中的消息往往用一个结构体MSG来表示，结构体MSG的定义如下：<br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">typedef </span>
				<span style="COLOR: #0000ff">struct</span>
				<span style="COLOR: #000000"> tagMSG<br /><img id="Codehighlighter1_22_236_Open_Image" onclick="this.style.display='none'; Codehighlighter1_22_236_Open_Text.style.display='none'; Codehighlighter1_22_236_Closed_Image.style.display='inline'; Codehighlighter1_22_236_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_22_236_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_22_236_Closed_Text.style.display='none'; Codehighlighter1_22_236_Open_Image.style.display='inline'; Codehighlighter1_22_236_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_22_236_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_22_236_Open_Text">
						<span style="COLOR: #000000">{    HWND  hwnd;  </span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> 获取消息的窗口句柄，若此参数为null，则可检索所有驻留在消息队列中的消息</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
						</span>
						<span style="COLOR: #000000">     UINT  message; </span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> 消息编号</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
						</span>
						<span style="COLOR: #000000">     WPARAM # wParam; </span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> 消息的附加信息</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
						</span>
						<span style="COLOR: #000000">     LPARAM # lParam; <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />     DWORD  time; </span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> 指定消息发送至消息队列的时间</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
						</span>
						<span style="COLOR: #000000">     POINT  pt; </span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> 指定消息发送时，屏幕光标的位置</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />
						</span>
						<span style="COLOR: #000000">}</span>
				</span>
				<span style="COLOR: #000000"> MSG;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
		</div>
		<br />其中pt的数据类型也是一个结构体PIONT，其定义为：<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">typedef </span><span style="COLOR: #0000ff">struct</span><span style="COLOR: #000000"> tagPOINT<br /><img id="Codehighlighter1_24_73_Open_Image" onclick="this.style.display='none'; Codehighlighter1_24_73_Open_Text.style.display='none'; Codehighlighter1_24_73_Closed_Image.style.display='inline'; Codehighlighter1_24_73_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_24_73_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_24_73_Closed_Text.style.display='none'; Codehighlighter1_24_73_Open_Image.style.display='inline'; Codehighlighter1_24_73_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_24_73_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_24_73_Open_Text"><span style="COLOR: #000000">{    LONG x;  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> x和y分别表示屏幕的横坐标和纵坐标</span><span style="COLOR: #008000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">      LONG y;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000"> POINT;</span></div><p><br /><br /><font color="#ff0000">消息</font>：<br />      VC++中存在几种系统定义的消息分类，常用的消息分类有窗口管理消息、初始化消息、输入消息、系统消息、剪贴板消息、控制处理消息、控制通知消息、滚动条通知信息、非用户区消息、文档界面消息、DDE（动态数据交换）消息、应用程序自定义的消息等。<br />系统定义的消息宏前缀：<br />BM   <u>按钮</u>控制消息；<br />CB   <u>组合框</u>控制消息；<br />DM   <u>默认下压式按钮控制</u>消息；<br />EM   <u>编辑</u>控制消息；<br />LB    <u>列表</u>控制消息；<br />SBM   <u>滚动条</u>控制消息；<br />WM   <u>窗口</u>消息；</p><p> </p><p>windows 应用程序常用消息：</p><img src ="http://www.cppblog.com/bestgz/aggbug/16233.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/bestgz/" target="_blank">bullGao</a> 2006-12-10 17:40 <a href="http://www.cppblog.com/bestgz/archive/2006/12/10/16233.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]C++怎么学?</title><link>http://www.cppblog.com/bestgz/archive/2006/12/07/16107.html</link><dc:creator>bullGao</dc:creator><author>bullGao</author><pubDate>Thu, 07 Dec 2006 13:31:00 GMT</pubDate><guid>http://www.cppblog.com/bestgz/archive/2006/12/07/16107.html</guid><wfw:comment>http://www.cppblog.com/bestgz/comments/16107.html</wfw:comment><comments>http://www.cppblog.com/bestgz/archive/2006/12/07/16107.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/bestgz/comments/commentRss/16107.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/bestgz/services/trackbacks/16107.html</trackback:ping><description><![CDATA[首先声明：本人对之也只能说略之一二(C++太博大了:))<br />  孟岩先生曾经提过"C++需要自由的心",我要说"C++需要自由的心和手",我敢肯定我想的自由和孟岩先生的自由是不同的.<br />因为我的自由就个人诠释是 ："用自己的思路来自由的写验证性的usecase"<br />  就个人的学习心得而言 ：
<p>1.在你学习C++的过程中,你首先需要扎实的实践一本C++基础教程,这个教程不在深而在全.使你能够全览之.最好结合基本数据结构来练习.不要整天Hello World~~Hello MM的.</p><p>2.再下来你需要《(More)Effective C++》,它使你可以对C++也多了份思考,也了解到一些技巧和误区,不过,你需要同步实践,不然可能一时你并不能真正掌握这些技巧、避开误区.</p><p>3.提高,你需要：(下面的书可能已经讲烂了:))</p><p>  《Design Pattern》 ：个人感觉,设计模式虽说是一种思维方式,具体实现上,只是<br />                        对OOP语言的发掘和巧妙组合而已.而且这里组合是主要的,<br />                        特性是有限的,这本书中有几个模式没用虚特性的? <br />   C++ Standard Document: 在你用它来做专项研究的时候,就会体会到什么才叫真正的<br />                                          全而深 (自然指在语法和语义的阐述上). <br />  《STL源码剖析》 ：没有深厚的功底,想来个闭门造车独挑STL源码是不可能的.<br />                                  不过,这本说也重在关键技术的讲解和引导罢了~~<br />                                   这里关于GP和STL的名著不少，本人没看过。不做品评。<br />  《 Inside The C++ Object Model》：最具价值的一本书,没了它,C++永远是个迷,哪怕<br />                                    你浸淫之N载~~<br />  《Moden In C++ Design》 ：这里的很多思路是你自己的思维很难接触到的~~：)<br />                            我不得不佩服Andrei Alexandrescu.</p><p>  市面上其它的C++书籍可牛车载,我感觉除了《The Design And Evolution Of C++》是异品,值得一读.其它的不建议花太多的时间,哪怕是Bjarne Stroustrup、Stanley B.Lippman等的作品.自然,你有时间读更好,反正我现在有点后悔,当初只顾多,不顾深读,反复读.经典的书不在本数多,在于每本读的遍数多.一经验之谈,BBS上经常有人,在介绍COM技术书籍时,想也不想的指出,入门级&lt;&lt;Inside The COM&gt;&gt;.是这样的吗?我想,正如Dale Rogerson所说,将这本书完全看懂,你就是COM专家了~~书中,作者很多话可能你没有注意到,因为你还不懂之,对之没感觉,一遍翻下来,感觉 哦~~简单~全看了 :) 这些书,跟国内的很多书籍最大的不同就是<br />国内书籍的作者写的出,可能自己还不懂:)Copy什么资料上的:)??</p><p>4.浸淫一门语言本身的语法语义再久,你不一定能够深入它的精妙之处.<br />  你需要学习应用这门语言的实作品(技术),你可以研究一些FrameWork或是一些具体的技术 如CORBA、COM等.就个人而已,有心接触C++十个月左右,对于Virtual的认识有过几次较大的的改变.在《 Inside The C++ Object Model》中算第一次,在《COM本质论》中关于COM对二进制兼容布局需求而用虚机制来解决是第二次,到目前为止,使我对virtual流下最深刻印象的是在Automation技术中组件由于环境是否有能力分析virtual结构而导致是否需要分发接口的问题.如果,整天抱着《C++语法语义深入》这样的书,我不知你何时才能真正了解C++很多的特性.<br />  即使你可以对别人说上一大套,这行啊~那不行啊~~云云~~:) </p><p>在这整个的过程中,我喜欢这样对学弟说,你需要经常将C++的各种特性在脑中反复混合酝踉,这也是我强调学基础时,要求教材知识点全的原因.经常的,为了研究某些特性而自由的写、修改、增加UseCase,是我自认为很好的一个习惯.整天记他人的经验之言,不知几个月后还记得几层:)?</p><p>   也许上面的叙述是概括了些:)?</p><p>   总之,我认为学习C++,需要多思考(譬如你想想为什么模板类继承不支持virtual、模板<br />                                   类继承,基类实例和继承类实例产生的关系是什么样的)、<br />                      多写usecase、<br />                      多将一堆特性混合酝晾（譬如模板类<br />                                  成员签名、多种嵌套模板类成员签名、嵌套类与包裹类生命期<br />                                 控制等等)<br />                      <br />                      要尽早选择应用方向(这点很重要,附加个人观点：大多数人认为理论很<br />                                         难，可是我要说：应用一样是有难度的:)).</p><p>                      将00工程学中的理论适时的来对照自己的行为.<br />     </p><p>后话：<br />    上面提到,就应用而已,比较语言的是没有什么意义的.然而我想说的是,不敢想象<br />没有经过C++锤炼的人,可以深入的研究C#(事实上，我一直也不人为C#比C++好学，只是他们的深入点是不同的，冒昧说一句，C++中很多难度是人为制造出来的),就目前的情况来说,还有就是由于C++历史、<br />社团、资源等因素.</p><img src ="http://www.cppblog.com/bestgz/aggbug/16107.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/bestgz/" target="_blank">bullGao</a> 2006-12-07 21:31 <a href="http://www.cppblog.com/bestgz/archive/2006/12/07/16107.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Inheritance Example</title><link>http://www.cppblog.com/bestgz/archive/2006/12/06/16063.html</link><dc:creator>bullGao</dc:creator><author>bullGao</author><pubDate>Wed, 06 Dec 2006 12:35:00 GMT</pubDate><guid>http://www.cppblog.com/bestgz/archive/2006/12/06/16063.html</guid><wfw:comment>http://www.cppblog.com/bestgz/comments/16063.html</wfw:comment><comments>http://www.cppblog.com/bestgz/archive/2006/12/06/16063.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/bestgz/comments/commentRss/16063.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/bestgz/services/trackbacks/16063.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Hierarchy using private Data, and three-level Inheritance Hierarchy:Circle类继承了Point类，而Cylinder类继承了Circle类，同时调用基类的构造函数，初始化数据Circle具有Point的特性，Cylinder具有Circle的特性，形成了三级继承关系base-class:												...&nbsp;&nbsp;<a href='http://www.cppblog.com/bestgz/archive/2006/12/06/16063.html'>阅读全文</a><img src ="http://www.cppblog.com/bestgz/aggbug/16063.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/bestgz/" target="_blank">bullGao</a> 2006-12-06 20:35 <a href="http://www.cppblog.com/bestgz/archive/2006/12/06/16063.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>