亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? wtl for mfc programmers, part i.mht

?? 大家知道wtl是window UI庫
?? MHT
?? 第 1 頁 / 共 5 頁
字號:
the idea=20
      of several hundred K of MFC framework getting added to your =
programs, WTL=20
      is for you. However, there are a few barriers we have to =
overcome:</P>
      <UL>
        <LI>ATL-style templates look weird at first.=20
        <LI>No ClassWizard support, so writing message maps involves =
some manual=20
        labor.=20
        <LI>No documentation in MSDN, you need to find it somewhere =
else, or=20
        even look at the WTL source.=20
        <LI>No reference books you can buy and keep on your shelf.=20
        <LI>It has that "not officially supported by Microsoft" stigma=20
        <LI>ATL/WTL windowing is sufficiently different from MFC =
windowing that=20
        not all your knowledge transfers over. </LI></UL>
      <P>On the other hand, the benefits of WTL are:</P>
      <UL>
        <LI>No complex doc/view framework to learn or work around.=20
        <LI>Has some essential UI features from MFC, like DDX/DDV and =
"update=20
        command UI" functionality.=20
        <LI>Actually improves on some MFC features (e.g., more flexible =
splitter=20
        windows)=20
        <LI>Much smaller executables compared to a statically-linked MFC =
app.=20
        <LI>You can apply bug fixes to WTL yourself and not affect =
existing apps=20
        (compare this with replacing the MFC/CRT DLLs to fix a bug in =
one app,=20
        and having other apps break)=20
        <LI>If you still need MFC, MFC and ATL/WTL windows can co-exist=20
        peacefully (for a prototype at work, I ended up creating an MFC=20
        <CODE>CFrameWnd</CODE> that contained a WTL=20
        <CODE>CSplitterWindow</CODE>, which contained MFC =
<CODE>CDialog</CODE>s=20
        -- that wasn't me showing off, it was modifying existing MFC =
code but=20
        using the nicer WTL splitter). </LI></UL>
      <P>In this series, I will first introduce the ATL windowing =
classes. WTL=20
      is, after all, a set of add-on classes to ATL, so a good =
understanding of=20
      ATL windowing is essential. Once I've covered that, I'll introduce =
WTL=20
      features and show how they make GUI programming a lot easier.</P>
      <H2><A name=3Dintopart1></A>Introduction to Part I</H2>
      <P>WTL rocks. But before we get to why, we need to cover ATL =
first. WTL is=20
      a set of add-on classes to ATL, and if you've been strictly an MFC =

      programmer in the past, you may never have encountered the ATL GUI =

      classes. So please bear with me if I don't get to WTL right off =
the bat;=20
      the detour into ATL is necessary.</P>
      <P>In this first part, I will give a little background on ATL, =
cover some=20
      essential points you need to know before writing ATL code, quickly =
explain=20
      those funky ATL templates, and cover the basic ATL windowing =
classes.</P>
      <H2><A name=3Datlbackground></A>ATL Background</H2>
      <H3><A name=3Datlhistory></A>ATL and WTL history</H3>
      <P>The Active Template Library... kind of an odd name, isn't it?=20
      Old-timers might remember that it was originally the =
Active<B>X</B>=20
      Template Library, which is a more accurate name, since ATL's goal =
is to=20
      make writing COM objects and ActiveX controls easier. (ATL was =
also=20
      developed during the time that Microsoft was naming new products=20
      ActiveX-something, just as new products nowadays are called=20
      something.NET.) Since ATL is really about writing COM objects, it =
only has=20
      the most basic of GUI classes, the equivalent of MFC's =
<CODE>CWnd</CODE>=20
      and <CODE>CDialog</CODE>. Fortunately, the GUI classes are =
flexible enough=20
      to allow for something like WTL to be built on top of them.</P>
      <P>WTL is currently in its second revision. The first was version =
3.1, and=20
      the second is version 7. (The version numbers were chosen to match =
the ATL=20
      version numbers, that's why they're not 1 and 2.) Version 3.1 =
works with=20
      VC 6 and VC 7, although you need to define a couple of =
preprocessor=20
      symbols for VC 7. WTL version 7 is a drop-in replacement for =
version 3.1,=20
      and works without modification on VC 7, so there really is no =
reason to=20
      use 3.1 for new development.</P>
      <H3><A name=3Datltemplates></A>ATL-style templates</H3>
      <P>Even if you can read C++ templates without getting a headache, =
there is=20
      two things ATL does that might trip you up at first. Take this =
class for=20
      example:</P><PRE><SPAN class=3Dcpp-keyword>class</SPAN> CMyWnd : =
<SPAN class=3Dcpp-keyword>public</SPAN> CWindowImpl&lt;CMyWnd&gt;
{
...
};</PRE>
      <P>That actually is legal, because the C++ spec says that =
immediately=20
      after the <CODE><SPAN class=3Dcpp-keyword>class</SPAN> =
CMyWnd</CODE> part,=20
      the name <CODE>CMyWnd</CODE> is defined and can be used in the =
inheritance=20
      list. The reason for having the class name as a template parameter =
is so=20
      ATL can do the second tricky thing, compile-time virtual function=20
      calls.</P>
      <P>To see this in action, look at this set of =
classes:</P><PRE><SPAN class=3Dcpp-keyword>template</SPAN> &lt;<SPAN =
class=3Dcpp-keyword>class</SPAN> T&gt;
<SPAN class=3Dcpp-keyword>class</SPAN> B1
{
<SPAN class=3Dcpp-keyword>public</SPAN>:=20
    <SPAN class=3Dcpp-keyword>void</SPAN> SayHi()=20
    {
    <FONT color=3Dred>T* pT =3D <SPAN =
class=3Dcpp-keyword>static_cast</SPAN>&lt;T*&gt;(<SPAN =
class=3Dcpp-keyword>this</SPAN>);</FONT>   <SPAN class=3Dcpp-comment>// =
HUH?? I'll explain this below</SPAN>
=20
        pT-&gt;PrintClassName();
    }
<SPAN class=3Dcpp-keyword>protected</SPAN>:
    <SPAN class=3Dcpp-keyword>void</SPAN> PrintClassName() { cout =
&lt;&lt; <SPAN class=3Dcpp-string>"This is B1"</SPAN>; }
};
=20
<SPAN class=3Dcpp-keyword>class</SPAN> D1 : <SPAN =
class=3Dcpp-keyword>public</SPAN> B1&lt;D1&gt;
{
    <SPAN class=3Dcpp-comment>// No overridden functions at all</SPAN>
};
=20
<SPAN class=3Dcpp-keyword>class</SPAN> D2 : <SPAN =
class=3Dcpp-keyword>public</SPAN> B1&lt;D2&gt;
{
<SPAN class=3Dcpp-keyword>protected</SPAN>:
    <SPAN class=3Dcpp-keyword>void</SPAN> PrintClassName() { cout =
&lt;&lt; <SPAN class=3Dcpp-string>"This is D2"</SPAN>; }
};
=20
main()
{
D1 d1;
D2 d2;
=20
    d1.SayHi();    <SPAN class=3Dcpp-comment>// prints "This is =
B1"</SPAN>
    d2.SayHi();    <SPAN class=3Dcpp-comment>// prints "This is =
D2"</SPAN>
}</PRE>
      <P>The <CODE><SPAN =
class=3Dcpp-keyword>static_cast</SPAN>&lt;T*&gt;(<SPAN=20
      class=3Dcpp-keyword>this</SPAN>)</CODE> is the trick here. It =
casts=20
      <CODE><SPAN class=3Dcpp-keyword>this</SPAN></CODE>, which is of =
type=20
      <CODE>B1*</CODE>, to either <CODE>D1*</CODE> or <CODE>D2*</CODE> =
depending=20
      on which specialization is being invoked. Because template code is =

      generated at compile-time, this cast is guaranteed to be safe, as =
long as=20
      the inheritance list is written correctly. (If you =
wrote</P><PRE><SPAN class=3Dcpp-keyword>class</SPAN> D3 : <SPAN =
class=3Dcpp-keyword>public</SPAN> B1&lt;D2&gt;</PRE>
      <P>you'd be in trouble.) It's safe because the <CODE><SPAN=20
      class=3Dcpp-keyword>this</SPAN></CODE> object can <I>only</I> be =
of type=20
      <CODE>D1*</CODE> or <CODE>D2*</CODE> (as appropriate), and nothing =
else.=20
      Notice that this is almost exactly like normal C++ polymorphism, =
except=20
      that the <CODE>SayHi()</CODE> method isn't virtual.</P>
      <P>To explain how this works, let's look at each call to=20
      <CODE>SayHi()</CODE>. In the first call, the specialization=20
      <CODE>B1&lt;D1&gt;</CODE> is being used, so the =
<CODE>SayHi()</CODE> code=20
      expands to:</P><PRE><SPAN class=3Dcpp-keyword>void</SPAN> =
B1&lt;D1&gt;::SayHi()
{
D1* pT =3D <SPAN class=3Dcpp-keyword>static_cast</SPAN>&lt;D1*&gt;(<SPAN =
class=3Dcpp-keyword>this</SPAN>);
=20
    pT-&gt;PrintClassName();
}</PRE>
      <P>Since <CODE>D1</CODE> does not override =
<CODE>PrintClassName()</CODE>,=20
      <CODE>D1</CODE>'s base classes are searched. <CODE>B1</CODE> has a =

      <CODE>PrintClassName()</CODE> method, so that is the one =
called.</P>
      <P>Now, take the second call to <CODE>SayHi()</CODE>. This time, =
it's=20
      using the specialization <CODE>B1&lt;D2&gt;</CODE>, and=20
      <CODE>SayHi()</CODE> expands to:</P><PRE><SPAN =
class=3Dcpp-keyword>void</SPAN> B1&lt;D2&gt;::SayHi()
{
D2* pT =3D <SPAN class=3Dcpp-keyword>static_cast</SPAN>&lt;D2*&gt;(<SPAN =
class=3Dcpp-keyword>this</SPAN>);
=20
    pT-&gt;PrintClassName();
}</PRE>
      <P>This time, <CODE>D2</CODE> <I>does</I> contain a=20
      <CODE>PrintClassName()</CODE> method, so that is the one that gets =

      called.</P>
      <P>The benefits of this technique are:</P>
      <UL>
        <LI>It doesn't require using pointers to objects.=20
        <LI>It saves memory because there is no need for vtbls.=20
        <LI>It's impossible to call a virtual function through a null =
pointer at=20
        runtime because of an uninitialized vtbl.=20
        <LI>All function calls are resolved at compile time, so they can =
be=20
        optimized. </LI></UL>
      <P>While the saving of a vtbl doesn't seem significant in this =
example (it=20
      would only be 4 bytes), think of the case where there are 15 base =
classes,=20
      some of those containing 20 methods, and the savings adds up.</P>
      <H2><A name=3Datlwindowing></A>ATL Windowing Classes</H2>
      <P>OK, enough background! Time to dive into ATL. ATL is designed =
with a=20
      strict interface/implementation division, and that's evident in =
the=20
      windowing classes. This is similar to COM, where interface =
definitions are=20
      completely separate from an implementation (or possibly several=20
      implementations).</P>
      <P>ATL has one class that defines the "interface" for a window, =
that is,=20
      what can be done with a window. This class is called =
<CODE>CWindow</CODE>.=20
      It is nothing more than a wrapper around an <CODE>HWND</CODE>, and =
it=20
      provides almost all of the User APIs that take an =
<CODE>HWND</CODE> as the=20
      first parameter, such as <CODE>SetWindowText()</CODE> and=20
      <CODE>DestroyWindow()</CODE>. <CODE>CWindow</CODE> has a public =
member=20
      <CODE>m_hWnd</CODE> that you can access if you need the raw=20
      <CODE>HWND</CODE>. <CODE>CWindow</CODE> also has a <CODE><SPAN=20
      class=3Dcpp-keyword>operator</SPAN> HWND</CODE> method, so you can =
pass a=20
      <CODE>CWindow</CODE> object to a function that takes an =
<CODE>HWND</CODE>.=20
      There is no equivalent to <CODE>CWnd::GetSafeHwnd()</CODE>.</P>
      <P><CODE>CWindow</CODE> is very different from MFC's =
<CODE>CWnd</CODE>.=20
      <CODE>CWindow</CODE> objects are inexpensive to create, since =
there is=20
      only one data member, and there is no equivalent to the object =
maps that=20
      MFC keeps internally to map <CODE>HWND</CODE>s to =
<CODE>CWnd</CODE>=20
      objects. Also unlike <CODE>CWnd</CODE>, when a =
<CODE>CWindow</CODE> object=20
      goes out of scope, <I>the associated window is not destroyed</I>. =
This=20
      means you don't have to remember to detach any temp =
<CODE>CWindow</CODE>=20
      objects you might create.</P>
      <P>The ATL class that has the implementation of a window is=20
      <CODE>CWindowImpl</CODE>. <CODE>CWindowImpl</CODE> contains the =
code for=20
      such things as window class registration, window subclassing, =
message=20
      maps, and a basic <CODE>WindowProc()</CODE>. Again, this is unlike =
MFC=20
      where everything is in one class, <CODE>CWnd</CODE>.</P>
      <P>There are also two separate classes that contain the =
implementation of=20
      a dialog box, <CODE>CDialogImpl</CODE> and =
<CODE>CAxDialogImpl</CODE>.=20
      <CODE>CDialogImpl</CODE> is used for plain dialogs, while=20
      <CODE>CAxDialogImpl</CODE> is used for dialogs that host ActiveX=20
      controls.</P>
      <H2><A name=3Dwindowimpl></A>Defining a Window Implementation</H2>
      <P>Any non-dialog window you create will derive from=20
      <CODE>CWindowImpl</CODE>. Your new class needs to contain three=20
things:</P>
      <OL>
        <LI>A window class definition=20
        <LI>A message map=20
        <LI>The default styles to use for the window, called the =
<I>window=20
        traits</I> </LI></OL>
      <P>The window class definition is done using the=20
      <CODE>DECLARE_WND_CLASS</CODE> or =
<CODE>DECLARE_WND_CLASS_EX</CODE> macro.=20
      Both of these define an ATL struct <CODE>CWndClassInfo</CODE> that =
wraps=20
      the <CODE>WNDCLASSEX</CODE> struct. <CODE>DECLARE_WND_CLASS</CODE> =
lets=20
      you specify the new window class name and uses default values for =
the=20
      other members, while <CODE>DECLARE_WND_CLASS_EX</CODE> lets you =
also=20
      specify a class style and window background color. You can also =
use=20
      <CODE>NULL</CODE> for the class name, and ATL will generate a name =
for=20
      you.</P>
      <P>Let's start out a new class definition, and I'll keep adding to =
it as=20
      we go through this section.</P><PRE><SPAN =
class=3Dcpp-keyword>class</SPAN> CMyWindow : <SPAN =
class=3Dcpp-keyword>public</SPAN> CWindowImpl&lt;CMyWindow&gt;
{
<SPAN class=3Dcpp-keyword>public</SPAN>:

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产精品一区二区www| 国产精品美女久久久久久久网站| 日本一区二区在线不卡| 亚洲成人av资源| 成人福利视频在线看| 欧美日韩不卡视频| 亚洲色图清纯唯美| 国产精选一区二区三区| 日韩三级视频在线观看| 午夜久久久久久久久久一区二区| 成人av在线观| 国产亚洲自拍一区| 久久精品国产亚洲a| 欧美日韩日本视频| 亚洲精品视频自拍| 成人免费毛片嘿嘿连载视频| 精品精品欲导航| 日韩av电影免费观看高清完整版 | 久久99精品一区二区三区三区| 一本色道综合亚洲| 欧美国产精品劲爆| 国产麻豆一精品一av一免费| 欧美一卡二卡三卡| 丝袜国产日韩另类美女| 欧洲日韩一区二区三区| 亚洲欧洲精品一区二区精品久久久 | 久久久91精品国产一区二区精品| 日韩福利视频网| 欧美老肥妇做.爰bbww| 一区二区免费在线播放| 91天堂素人约啪| 亚洲欧洲成人自拍| 成人黄页在线观看| 国产精品久久看| 99久久伊人精品| 亚洲欧美aⅴ...| 91视频在线观看免费| 亚洲视频在线一区| 91在线丨porny丨国产| 国产精品久久毛片| 99v久久综合狠狠综合久久| 国产精品成人一区二区艾草 | 五月婷婷激情综合| 在线成人免费视频| 免费成人性网站| 精品国产污污免费网站入口 | 亚洲一区免费在线观看| 欧美三级电影在线看| 亚洲成人在线网站| 4hu四虎永久在线影院成人| 五月婷婷激情综合| 日韩欧美的一区二区| 国产一区二区三区不卡在线观看| 久久人人爽爽爽人久久久| 国产成人在线视频网址| 亚洲国产精品成人综合色在线婷婷 | 一区二区日韩av| 欧美日韩激情一区二区三区| 日本sm残虐另类| 久久综合成人精品亚洲另类欧美 | 日本成人在线看| 精品99一区二区三区| 国产成人免费9x9x人网站视频| 国产精品麻豆一区二区| 一本大道久久精品懂色aⅴ| 亚洲综合一区二区精品导航| 91麻豆精品国产91久久久久 | 亚洲激情网站免费观看| 欧美日韩国产影片| 久久99精品视频| 中文字幕av一区二区三区免费看| 91一区二区三区在线观看| 午夜影视日本亚洲欧洲精品| 欧美v日韩v国产v| av一二三不卡影片| 亚洲福利国产精品| 精品美女在线观看| 91蜜桃在线观看| 日本少妇一区二区| 国产精品美女久久久久久久久| 欧美天堂亚洲电影院在线播放| 免费美女久久99| 中文字幕欧美一| 91精品国产综合久久久久久| 国产成人亚洲精品狼色在线| 亚洲精品免费播放| 欧美草草影院在线视频| 成人午夜私人影院| 日韩精品福利网| 国产精品理论在线观看| 欧美一区二区三区四区五区 | 精一区二区三区| 国产日韩欧美高清| 欧美日韩美女一区二区| 福利一区二区在线观看| 亚洲国产你懂的| 国产欧美精品区一区二区三区| 在线观看国产一区二区| 国产一区二区三区观看| 亚洲图片欧美视频| 国产亚洲精品bt天堂精选| 欧美剧情电影在线观看完整版免费励志电影| 国产综合久久久久久鬼色| 亚洲精品日产精品乱码不卡| 久久久久久电影| 欧美人xxxx| 91小视频免费看| 国产乱一区二区| 日韩综合一区二区| 国产精品久久久久久久久久免费看| 欧美一三区三区四区免费在线看| 99国产精品久久久久久久久久| 久久99精品久久久| 亚洲小说欧美激情另类| 中文字幕乱码一区二区免费| 日韩欧美国产系列| 欧洲一区在线电影| 成人精品一区二区三区中文字幕| 麻豆91精品91久久久的内涵| 一区二区三区高清不卡| 日本一区二区三区久久久久久久久不| 91精品一区二区三区久久久久久| 91无套直看片红桃| 风间由美一区二区三区在线观看 | 白白色 亚洲乱淫| 国产伦精品一区二区三区免费| 午夜激情综合网| 亚洲综合网站在线观看| 18成人在线观看| 欧美激情一区在线观看| 亚洲精品在线观| 日韩精品一区二区在线观看| 欧美日韩高清一区二区三区| 色激情天天射综合网| 成人h动漫精品一区二| 国产一区二区三区黄视频| 六月丁香婷婷色狠狠久久| 首页欧美精品中文字幕| 亚洲国产精品麻豆| 一区二区三区不卡在线观看| 亚洲私人黄色宅男| 亚洲欧洲精品成人久久奇米网| 中文字幕高清不卡| 国产精品网站在线| 国产午夜精品在线观看| 久久久久亚洲蜜桃| 国产亚洲欧美日韩俺去了| 精品日韩欧美一区二区| 精品久久久久久综合日本欧美| 日韩视频不卡中文| 欧美成人女星排名| 日韩欧美成人一区二区| 欧美zozo另类异族| 久久综合久久综合久久| 欧美不卡视频一区| 精品99久久久久久| 久久精品一区八戒影视| 国产欧美一区二区在线观看| 国产免费久久精品| 亚洲欧洲精品一区二区三区| 日韩一区日韩二区| 一区二区三区在线免费观看| 亚洲精品亚洲人成人网| 国产不卡在线视频| 成人晚上爱看视频| 91欧美一区二区| 欧美亚洲综合在线| 51精品国自产在线| 日韩精品专区在线影院重磅| 精品欧美一区二区在线观看| 国产亚洲人成网站| 一区在线播放视频| 亚洲一线二线三线视频| 午夜精品成人在线| 裸体歌舞表演一区二区| 国产精品18久久久久久久久 | 免费高清在线视频一区·| 久久国产精品99久久人人澡| 国产精品一级在线| 9l国产精品久久久久麻豆| 色噜噜偷拍精品综合在线| 欧美亚洲高清一区| 日韩欧美中文一区二区| 久久综合999| 中文字幕一区不卡| 亚洲高清免费观看高清完整版在线观看| 日韩电影免费一区| 韩国v欧美v日本v亚洲v| 丁香激情综合五月| 欧美午夜一区二区| 精品国产乱码久久久久久久久| 欧美国产精品v| 午夜精品视频一区| 国产伦精一区二区三区| 69精品人人人人| 日韩欧美精品在线| 日韩精品一区二区在线观看| 97久久精品人人做人人爽50路| 欧美性猛交xxxxxx富婆| 福利91精品一区二区三区|