﻿<?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++博客-chlf</title><link>http://www.cppblog.com/chlf/</link><description /><language>zh-cn</language><lastBuildDate>Mon, 13 Apr 2026 09:37:51 GMT</lastBuildDate><pubDate>Mon, 13 Apr 2026 09:37:51 GMT</pubDate><ttl>60</ttl><item><title>独立的界面肤化库</title><link>http://www.cppblog.com/chlf/archive/2006/02/16/3296.html</link><dc:creator>VC进阶</dc:creator><author>VC进阶</author><pubDate>Thu, 16 Feb 2006 14:46:00 GMT</pubDate><guid>http://www.cppblog.com/chlf/archive/2006/02/16/3296.html</guid><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><A name=_Toc94754440><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">引言：</SPAN><SPAN lang=EN-US><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></B></A></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="mso-bookmark: _Toc94754440"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></B></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">现在的应用软件都讲究个性化，因此提供一套漂亮的皮肤就必不可少。这就需要用到一些控件肤化技术。常规是重载</SPAN><SPAN lang=EN-US>MFC</SPAN></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的消息列表或虚函数来实现的，但引来的问题是肤化库和应用程序的耦合性太强。经常会由于肤化代码的一处小改动而引起逻辑上并没有关联的整个应用程序大规模的编译和链接，并带来开发效率的急剧下降，这在开发大型软件时是很难忍受的。</SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="mso-bookmark: _Toc94754440"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">本文在参考了一些常用肤化技术后提供了自己的解决方案：采用替换窗体过程，皮肤库高度独立，内部完善与修改毫不影响应用程序。</SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="mso-bookmark: _Toc94754440"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="mso-bookmark: _Toc94754440"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">常见肤化方法：</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; mso-para-margin-left: 2.0gd"><SPAN style="mso-bookmark: _Toc94754440"><A name=_Toc94754441><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第一种：利用继承关系直接子类化</SPAN></A></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="mso-bookmark: _Toc94754440"><A name=_Toc94754442><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第二种：在一个对话框的</SPAN><SPAN lang=EN-US> OnInitDialog </SPAN></A></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN style="mso-bookmark: _Toc94754442"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中逐控件子类化</SPAN></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="mso-bookmark: _Toc94754440"><A name=_Toc94754443><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">第三种：在</SPAN></A></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN style="mso-bookmark: _Toc94754443"><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana"> Hook </SPAN></SPAN></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN style="mso-bookmark: _Toc94754443"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">中拦截窗口创建消息，并进行子类化</SPAN></SPAN></SPAN><SPAN style="mso-bookmark: _Toc94754443"></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="mso-bookmark: _Toc94754440"><A name=_Toc94754444><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">第四种</SPAN></A></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN style="mso-bookmark: _Toc94754444"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana"> </SPAN></SPAN></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN style="mso-bookmark: _Toc94754444"><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: #a000a0; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">SetWindowLong</SPAN></SPAN></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN style="mso-bookmark: _Toc94754444"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">替换窗口过程</SPAN></SPAN></SPAN><SPAN style="mso-bookmark: _Toc94754444"></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 23.45pt; mso-char-indent-count: 2.13"><SPAN style="mso-bookmark: _Toc94754440"><A name=_Toc94754445><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">第五种</SPAN></A></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN style="mso-bookmark: _Toc94754445"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana"> </SPAN></SPAN></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN style="mso-bookmark: _Toc94754445"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">在</SPAN></SPAN></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN style="mso-bookmark: _Toc94754445"><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana">Hook</SPAN></SPAN></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN style="mso-bookmark: _Toc94754445"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">中替换窗口过程</SPAN></SPAN></SPAN><SPAN style="mso-bookmark: _Toc94754445"></SPAN><SPAN style="mso-bookmark: _Toc94754440"><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></SPAN></P><SPAN style="mso-bookmark: _Toc94754440"></SPAN>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><A name=_Toc94754446><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">各种肤化技术的原理：</SPAN></B></A><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; mso-para-margin-left: 2.0gd"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 黑体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">第一类方法采用的是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana; mso-fareast-font-family: 黑体">MFC</SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 黑体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">子类化方法来实现（前三种）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-para-margin-left: 2.0gd; mso-list: l2 level1 lfo1; tab-stops: list 42.0pt"><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></B><SPAN lang=EN-US>MFC </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">通过维护内部一张</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">ChandleMap</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来记录</SPAN><SPAN lang=EN-US>Window</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控件与控件子类对象之间的关系。在</SPAN><SPAN lang=EN-US>MFC</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的全局窗口过程</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: #880000; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">AfxWndProc</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">(</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">HWND</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: gray; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">hWnd</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">, </SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">UINT</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: gray; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">nMsg</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">, </SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">WPARAM</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: gray; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">wParam</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">, </SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">LPARAM</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: gray; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">lParam</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">)</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">中，</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">通过调用</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">CWnd</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">::</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: #880000; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">FromHandlePermanent</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">(</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">HWND</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"> </SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: gray; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">hWnd</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">)</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">得到参数句柄所依附的</SPAN><SPAN lang=EN-US>C+</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控件子类对象，并调用虚函数</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">CWnd</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">::</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: gray; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">WindowProc</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将相应的消息送给相应的控件子类对象的窗口过程</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-para-margin-left: 2.0gd; mso-list: l2 level1 lfo1; tab-stops: list 42.0pt"><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控件子类对象调用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: blue; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">CWnd</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">::</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: #880000; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">SubclassWindow</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">登记</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控件与控件子类对象之间的关系</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; mso-para-margin-left: 2.0gd"><A name=_Toc94754448><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 黑体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">第二类方法采用替换窗口过程方法来实现（第四、五种）</SPAN></A><SPAN style="mso-bookmark: _Toc94754448"></SPAN><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana; mso-fareast-font-family: 黑体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">肤化技术</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">分析：</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 10.5pt; TEXT-INDENT: 10.5pt; mso-para-margin-left: 1.0gd"><SPAN lang=EN-US style="mso-bidi-font-weight: bold">MFC</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">采用具有层次结构的控件子类设计：通过一张</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">Map</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表建立控件句柄与</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">C++</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象（控件子类对象）的联系，通过控件子类对象的变量来记录和维护控件的状态信息</SPAN><B><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">“肤化”的本质：</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt"><SPAN lang=EN-US>1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）响应发送给该控件的</SPAN><SPAN lang=EN-US>Windows</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">消息，</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt"><SPAN lang=EN-US>2</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）用恰当的数据表现出恰当的行为。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其中：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US>1)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以用替换窗体过程来实现，</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US>2)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以用维护自定义控件子类对象和控件句柄的关系来实现。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; mso-para-margin-left: 2.0gd"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">本文独立肤化库采用的方法：</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l1 level1 lfo2; tab-stops: list 42.0pt"><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-font-kerning: 22.0pt; mso-bidi-font-family: Verdana"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-font-kerning: 22.0pt">目标：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana; mso-font-kerning: 22.0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; mso-para-margin-left: 2.0gd"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">肤化目标窗口，接口简单，并且被肤化的窗口影响小。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l1 level1 lfo2; tab-stops: list 42.0pt"><B><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN></B><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">采用方法：</SPAN><B><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; mso-para-margin-left: 2.0gd"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">替换窗口过程</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l1 level1 lfo2; tab-stops: list 42.0pt"><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-font-kerning: 22.0pt; mso-bidi-font-family: Verdana"><SPAN style="mso-list: Ignore">3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">难点</SPAN><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-font-kerning: 22.0pt">：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana; mso-font-kerning: 22.0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; mso-para-margin-left: 2.0gd"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">窗口过程的设计，是否需要为每个类都设计单独的窗口过程？工作量是否过大？</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; mso-para-margin-left: 2.0gd"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">维护状态变量，当有多个控件共享同一窗口过程时，如何维护它们各自的状态？</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">实现方法</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana">:<o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l3 level1 lfo3; tab-stops: list 42.0pt"><SPAN lang=EN-US style="mso-bidi-font-weight: bold; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">仿照</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">MFC</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，建立统一的窗体过程</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">SkinWndProc<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l3 level1 lfo3; tab-stops: list 42.0pt"><SPAN lang=EN-US style="mso-bidi-font-weight: bold; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">建立一张</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">Map</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表，用来登记</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">hWnd</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和自定义控件子类对象之间的联系。</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l3 level1 lfo3; tab-stops: list 42.0pt"><SPAN lang=EN-US style="mso-bidi-font-weight: bold; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">创建一个皮肤父类，所有的肤化控件均从它派生（类似与</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">MFC</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">CWnd</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">），可以在统一的窗体过程</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">SkinWndProc</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中通过</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">Map</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表找到相应的自定义控件子类对象，并调用其虚函数实现对</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">Windows</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">消息的响应</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l3 level1 lfo3; tab-stops: list 42.0pt"><SPAN lang=EN-US style="mso-bidi-font-weight: bold; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">4.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">重载</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">:SubclassWindow</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函数，用来完成窗体过程的替换。</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">外部接口：</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo4; tab-stops: list 42.0pt"><SPAN lang=EN-US style="mso-bidi-font-weight: bold; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提供</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">SkinDlg(HWND hWnd)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">完成对对话框及其子控件的肤化</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo4; tab-stops: list 42.0pt"><SPAN lang=EN-US style="mso-bidi-font-weight: bold; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提供</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">SkinBtn(HWND hWnd, LPCTSTR lpszSection)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指定采用配制文件的哪一节属性肤化按钮</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo4; tab-stops: list 42.0pt"><SPAN lang=EN-US style="mso-bidi-font-weight: bold; mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果需要，提供</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">DonotSkinCtrl(HWND hWnd)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用来指定不需要肤化的控件</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo4; tab-stops: list 42.0pt"><B><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">4.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提供</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">ChangeSkin</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">LPCTSTR lpszSkinName</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-weight: bold; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）更换皮肤</SPAN><B><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">框架原理图：<BR><IMG height=351 alt=框架原理图.bmp src="http://www.cppblog.com/images/cppblog_com/chlf/独立的界面肤化库/框架原理图.bmp" width=653 border=0><BR></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时序图：</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><IMG height=578 alt=时序图：.bmp src="http://www.cppblog.com/images/cppblog_com/chlf/独立的界面肤化库/时序图：.bmp" width=750 border=0></SPAN></P><img src ="http://www.cppblog.com/chlf/aggbug/3296.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/chlf/" target="_blank">VC进阶</a> 2006-02-16 22:46 <a href="http://www.cppblog.com/chlf/archive/2006/02/16/3296.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>多人开发基础：组件化编程的简化实现</title><link>http://www.cppblog.com/chlf/archive/2006/02/13/3240.html</link><dc:creator>VC进阶</dc:creator><author>VC进阶</author><pubDate>Mon, 13 Feb 2006 13:55:00 GMT</pubDate><guid>http://www.cppblog.com/chlf/archive/2006/02/13/3240.html</guid><description><![CDATA[<DIV class=postbody>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">引言：</SPAN><SPAN lang=EN-US><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在上一篇文章中，我们引入了一个组件化编程的架构，其实它是一个仿</SPAN><SPAN lang=EN-US>COM</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">架构。尽管相对于</SPAN><SPAN lang=EN-US>COM</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而言它已经相当的简单了，但总的来说它仍是比较复杂。本文引入了另一种组件化编程的实现架构，相对于仿</SPAN><SPAN lang=EN-US>COM</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">篇而言，它的结构更加清晰，实现更加简单。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">组件化编程再分析：</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其实引入组件化编程的关键目的是为了将程序模块化，使各个模块之间可以单独开发，单独测试。当然，随之而来的</SPAN><SPAN lang=EN-US>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">版本问题也必须要解决，防止出现不兼容的组件版本破坏程序的稳定性。只需要达到几个目的就行了，我们没必要把事情做得太过于复杂。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实现：</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将程序模块化，使之可以单独开发、测试而不影响其它的模块，仍然需要将每个模块分解到</SPAN><SPAN lang=EN-US>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">去实现。通常因为面向对象、函数同名、函数地址偏移，使用方便等等原因，我们不希望直接使用</SPAN><SPAN lang=EN-US>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">导出</SPAN><SPAN lang=EN-US>API</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，而希望能使用接口，以面向对象的方式编程。为了解决版本问题，我们给每个接口的实现版本加个标示。既我们可以要求</SPAN><SPAN lang=EN-US>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">给出</SPAN><SPAN lang=EN-US>1.0</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">版的接口实现。</SPAN><SPAN lang=EN-US>2.0</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">版的接口实现等。还有，我们还要告诉</SPAN><SPAN lang=EN-US>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我们想获得哪个接口。于是统一起来，给每个接口加个唯一</SPAN><SPAN lang=EN-US>ID,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">因为通常我们的程序不会在全球发行，所以也没必要使用</SPAN><SPAN lang=EN-US>GUID</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，使用字符串标示就行了。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">每个接口的实现都有自己的创建函数，所以我们在每个模块中建立一张表，维护接口标示与接口创建函数的关系</SPAN></P>
<TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 480; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext" cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: teal; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 131.4pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt" vAlign=top width=175>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center><B style="mso-bidi-font-weight: normal"><SPAN style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口标示</SPAN><SPAN lang=EN-US style="COLOR: blue"><o:p></o:p></SPAN></B></P></TD>
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: teal; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 294.7pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" vAlign=top width=393>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center><B style="mso-bidi-font-weight: normal"><SPAN style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">全局创建函数</SPAN><SPAN lang=EN-US style="COLOR: blue"><o:p></o:p></SPAN></B></P></TD></TR>
<TR style="mso-yfti-irow: 1">
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 131.4pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=175>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>“VUIManager<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:chmetcnv TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="1" UnitName="”" w:st="on">001”</st1:chmetcnv></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 294.7pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=393>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">__g_Create</SPAN><SPAN lang=EN-US>VUIManager001</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">interfaceNam_reg()</SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 2">
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 131.4pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=175>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>“VUIManager<st1:chmetcnv TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="2" UnitName="”" w:st="on">002”</st1:chmetcnv></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 294.7pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=393>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">__g_Create</SPAN><SPAN lang=EN-US>VUIManager002</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">interfaceNam_reg()</SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 3">
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 131.4pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=175>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>“VSkin<st1:chmetcnv TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="1" UnitName="”" w:st="on">001”</st1:chmetcnv></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 294.7pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=393>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">__g_Create</SPAN><SPAN lang=EN-US>VSkin001</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">interfaceNam_reg()</SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 4; mso-yfti-lastrow: yes">
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 131.4pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=175>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>“VSkin<st1:chmetcnv TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="2" UnitName="”" w:st="on">002”</st1:chmetcnv></SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 294.7pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=393>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">__g_Create</SPAN><SPAN lang=EN-US>VSkin002</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">interfaceNam_reg()</SPAN></P></TD></TR></TBODY></TABLE>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN lang=EN-US>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中导出接口创建</SPAN><SPAN lang=EN-US>API </SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;</SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: #a000a0; mso-font-kerning: 0pt">DLL_EXPORT</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: blue; mso-font-kerning: 0pt">void</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">*</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: #880000; mso-font-kerning: 0pt">CreateInterface</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">(</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: blue; mso-font-kerning: 0pt">const</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: blue; mso-font-kerning: 0pt">char</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt"> *</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: gray; mso-font-kerning: 0pt">pInterfaceName</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">, </SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: blue; mso-font-kerning: 0pt">int</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt"> *</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: gray; mso-font-kerning: 0pt">pReturnCode</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; mso-font-kerning: 0pt">);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><IMG height=366 alt=简化接口的创建过程.bmp src="http://www.cppblog.com/images/cppblog_com/chlf/组件化编程的简化实现/简化接口的创建过程.bmp" width=554 border=0><BR>小结：</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">本实现仅是组件化编程的一个简化实现，它并不能取代《仿</SPAN><SPAN lang=EN-US>COM</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">篇》，它所实现的功能也不如《仿</SPAN><SPAN lang=EN-US>COM</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">篇》那么强大，例如它需要实现知道接口所在的</SPAN><SPAN lang=EN-US>DLL</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，不能实现自扩展等。但对于一般的程序而言，它更简单使用。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">还可以使用宏定义</SPAN> <SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">把接口标示和接口创建函数与创建过程关联起来，将接口创建</SPAN><SPAN lang=EN-US>API</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">也包装起来，开发中将更加方便。只需一个宏就可以搞定这些操作。</SPAN></P></DIV><img src ="http://www.cppblog.com/chlf/aggbug/3240.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/chlf/" target="_blank">VC进阶</a> 2006-02-13 21:55 <a href="http://www.cppblog.com/chlf/archive/2006/02/13/3240.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>多人开发的基础---组件化编程,仿COM篇</title><link>http://www.cppblog.com/chlf/archive/2006/01/25/3029.html</link><dc:creator>VC进阶</dc:creator><author>VC进阶</author><pubDate>Wed, 25 Jan 2006 13:07:00 GMT</pubDate><guid>http://www.cppblog.com/chlf/archive/2006/01/25/3029.html</guid><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 引言：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在大型项目的开发中，随着开发进度的进行，我们经常碰到模块之间耦合度太高的问题：由于开发人员经常要在别的模块中调用自己实现的功能，经常随意在某个函数中随意添加调用代码，造成了被修改的那个函数体过长，逻辑混乱。另一个问题是随意包含头文件：开发人员在开发中经常为了要使用某些类的功能而包含引用类的头文件造成类之间的耦合度太...&nbsp;&nbsp;<a href='http://www.cppblog.com/chlf/archive/2006/01/25/3029.html'>阅读全文</a><img src ="http://www.cppblog.com/chlf/aggbug/3029.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/chlf/" target="_blank">VC进阶</a> 2006-01-25 21:07 <a href="http://www.cppblog.com/chlf/archive/2006/01/25/3029.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>