⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wtl for mfc programmers, part ii.mht

📁 大家知道wtl是window UI库
💻 MHT
📖 第 1 页 / 共 5 页
字号:
src=3D"http://www.codeproject.com/script/images/support_icon.gif"=20
                  width=3D16></TD>
                <TD class=3DsmallText><A=20
                  href=3D"http://www.codeproject.com/store/"><B>VS.NET =
2003 from=20
                  $899</B></A></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  =
src=3D"http://www.codeproject.com/script/images/support_icon.gif"=20
                  width=3D16></TD>
                <TD class=3DsmallText><A=20
                  href=3D"http://www.codeproject.com/store/"><B>MSDN =
Univ. from=20
                  $1950</B></A></TD></TR>
              <TR vAlign=3Dtop>
                <TD></TD>
                <TD></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  src=3D"http://www.codeproject.com/images/print.gif" =
width=3D16></TD>
                <TD class=3DsmallText><A=20
                  =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp?print=3Dtrue"=20
                  target=3D_print>Print version</A></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  src=3D"http://www.codeproject.com/images/link.gif" =
width=3D16></TD>
                <TD class=3DsmallText><A=20
                  =
href=3D"http://www.codeproject.com/script/profile/add_bookmark.asp?t=3D0&=
amp;ct=3D%2Fwtl%2Fwtl4mfc2%2Easp&amp;guid=3DWTL4MFC2%2Fwtl3%2F27%2F2003">=
Bookmark=20
                  this</A></TD></TR></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  src=3D"http://www.codeproject.com/images/mail.gif" =
width=3D16></TD>
                <TD class=3DSmallText><A=20
                  =
href=3D"http://www.codeproject.com/script/recommend/form.asp?guid=3DWTL4M=
FC2%2Fwtl3%2F27%2F2003">Send=20
                  to a friend</A></TD></TR>
              <TR vAlign=3Dtop>
                <TD></TD>
                <TD></TD></TR>
              <TR vAlign=3Dtop>
                <TD></TD>
                <TD class=3DInfoBarHeader>My Profile</TD></TR>
              <TR>
                <TD bgColor=3Dblack colSpan=3D2><IMG height=3D1=20
                  src=3D"http://www.codeproject.com/images/space.gif"=20
              width=3D1></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  =
src=3D"http://www.codeproject.com/images/profile_small.gif"=20
                  width=3D16></TD>
                <TD class=3DsmallText><A=20
                  =
href=3D"http://www.codeproject.com/script/profile/modify.asp?ct=3D/wtl/wt=
l4mfc2.asp">My=20
                  Settings</A></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  =
src=3D"http://www.codeproject.com/images/submit_small.gif"=20
                  width=3D16></TD>
                <TD class=3DsmallText><A=20
                  =
href=3D"http://www.codeproject.com/script/articles/list_articles.asp?user=
id=3D273403">My=20
                  Articles</A></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  =
src=3D"http://www.codeproject.com/images/bookmarks.gif"=20
                width=3D16></TD>
                <TD class=3DsmallText><A=20
                  =
href=3D"http://www.codeproject.com/script/profile/bookmark_list.asp">My=20
                  Bookmarks</A></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  =
src=3D"http://www.codeproject.com/images/logoff_small.gif"=20
                  width=3D16></TD>
                <TD class=3DsmallText><A=20
                  =
href=3D"http://www.codeproject.com/script/profile/logoff.asp?ct=3D/wtl/wt=
l4mfc2.asp">Sign=20
                  out</A></TD></TR>
              <TR>
                <TD bgColor=3Dblack colSpan=3D2><IMG height=3D1=20
                  src=3D"http://www.codeproject.com/images/space.gif"=20
              width=3D1></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD>&nbsp;</TD></TR>
        <TR>
          <TD>
            <CENTER><A=20
            =
href=3D"http://www.codeproject.com/script/admentor/admentorredir.asp?id=3D=
482&amp;way=3Dban"=20
            target=3D_blank><IMG height=3D600=20
            alt=3D"Ultimate Toolbox 9.0 - MFC 7.0 Compliant, with Office =
2003 like and Office XP like classes and hundreds more, all with 100% =
MFC source code"=20
            =
src=3D"http://www.codeproject.com/script/admentor/images/Toolbox9Sky.gif"=
=20
            width=3D120 =
border=3D0></A><BR></CENTER><BR></TD></TR></TBODY></TABLE></TD>
    <TD width=3D5 rowSpan=3D2><IMG height=3D1=20
      src=3D"http://www.codeproject.com/images/space.gif" width=3D5> =
</TD>
    <TD align=3Dright width=3D"100%" bgColor=3Dwhite>
      <TABLE width=3D"100%">
        <TBODY>
        <TR>
          <TD class=3DsmallText vAlign=3Dtop noWrap></TD>
          <TD noWrap align=3Dright><A name=3D__top></A>
            <TABLE>
              <TBODY>
              <TR>
                <TD class=3DsmallText align=3Dright>77 members have =
rated this=20
                  article. Result:</TD>
                <TD>
                  <TABLE cellSpacing=3D0 cellPadding=3D0 border=3D2>
                    <TBODY>
                    <TR>
                      <TD><IMG height=3D5=20
                        =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                        width=3D20 border=3D0></TD>
                      <TD><IMG height=3D5=20
                        =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                        width=3D20 border=3D0></TD>
                      <TD><IMG height=3D5=20
                        =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                        width=3D20 border=3D0></TD>
                      <TD><IMG height=3D5=20
                        =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                        width=3D20 border=3D0></TD>
                      <TD><IMG height=3D5=20
                        =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                        width=3D18 border=3D0><IMG height=3D5=20
                        =
src=3D"http://www.codeproject.com/script/images/white.gif"=20
                        width=3D2 =
border=3D0></TD></TR></TBODY></TABLE></TD></TR>
              <TR>
                <TD class=3DsmallText align=3Dright colSpan=3D2><A=20
                  title=3D"Calculated as rating x Log10(# votes)"=20
                  =
href=3D"http://www.codeproject.com/script/articles/top_articles.asp?st=3D=
2">Popularity:=20
                  9.27</A>. Rating: <B>4.92</B> out of=20
        5.</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD vAlign=3Dtop width=3D"100%">
      <DIV id=3Dcontentdiv><!-- Article Starts -->
      <UL class=3Ddownload>
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/WTL4MFC2/WTL4MFC2_demo.zip">Downlo=
ad=20
        demo project - 59 Kb</A> </LI></UL><!-- Add the rest of your =
HTML here -->
      <H2>Contents</H2>
      <UL>
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#intopart2">Introducti=
on=20
        to Part II</A>=20
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#wtloverview">WTL=20
        Overview</A>=20
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#beginningexe">Beginni=
ng=20
        a WTL EXE</A>=20
        <LI><A =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#wtlmsgmap">WTL=20
        Message Map Enhancements</A>=20
        <LI><A =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#appwizard">What=20
        You Get with the WTL AppWizard</A>=20
        <UL>
          <LI><A=20
          =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#thruwizard">Going=20
          through the wizard</A>=20
          <LI><A=20
          =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#examinecode">Examinin=
g=20
          the generated code</A> </LI></UL>
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#msgloopinternals">CMe=
ssageLoop=20
        Internals</A>=20
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#frameinternals">CFram=
eWindowImpl=20
        Internals</A>=20
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#backtotheclock">Back =

        to the Clock Program</A>=20
        <LI><A =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#uiupdating">UI=20
        Updating</A>=20
        <UL>
          <LI><A=20
          =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#newmenuitems">New=20
          menu items to control the clock</A>=20
          <LI><A=20
          =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#callinguienable">Call=
ing=20
          UIEnable()</A> </LI></UL>
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#fixclassview">One =
Last=20
        Note on Message Maps</A>=20
        <LI><A =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#nextup">Next=20
        Stop, 1995</A>=20
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc2.asp#revisionhistory">Revi=
sion=20
        History</A> </LI></UL>
      <P>
      <H2><A name=3Dintopart2></A>Introduction to Part II</H2>
      <P>OK, time to actually start talking about WTL! In this part I'll =
cover=20
      the basics of writing a main frame window and cover some of the =
welcome=20
      improvements WTL gives, such as UI updating and better message =
maps. To=20
      get the most out of this part, you should have WTL installed so =
the header=20
      files are in the VC search path, and the AppWizard is in the =
appropriate=20
      directory. The WTL distribution comes with instructions on how to =
install=20
      the AppWizard, so consult the docs.</P>
      <H2><A name=3Dwtloverview></A>WTL Overview</H2>
      <P>The WTL classes can be divided into a few major categories:</P>
      <OL>
        <LI>Frame window implementation - <CODE>CFrameWindowImpl</CODE>, =

        <CODE>CMDIFrameWindowImpl</CODE>=20
        <LI>Control wrappers - <CODE>CButton</CODE>, =
<CODE>CListViewCtrl</CODE>=20
        <LI>GDI wrappers - <CODE>CDC</CODE>, <CODE>CMenu</CODE>=20
        <LI>Special UI features - <CODE>CSplitterWindow</CODE>,=20
        <CODE>CUpdateUI</CODE>, <CODE>CDialogResize</CODE>,=20
        <CODE>CCustomDraw</CODE>=20
        <LI>Utility classes and macros - <CODE>CString</CODE>,=20
        <CODE>CRect</CODE>, <CODE>BEGIN_MSG_MAP_EX</CODE> </LI></OL>
      <P>This article will cover frame windows in depth and touch on =
some of the=20
      UI features and utility classes. Most of the classes are =
stand-alone=20
      classes, although a few such as <CODE>CDialogResize</CODE> are=20
mix-ins.</P>
      <H2><A name=3Dbeginningexe></A>Beginning a WTL EXE</H2>
      <P>If you don't use the WTL AppWizard (we'll get to that later), a =
WTL EXE=20
      begins much like an ATL EXE. The sample code in this article will =
be=20
      another frame window as in Part I, but will be a bit less trivial =
in order=20
      to show some WTL features.</P>
      <P>For this section, we'll start a new EXE from scratch. The main =
window=20
      will show the current time in its client area. Here is a basic=20
      stdafx.h:</P><PRE><SPAN class=3Dcpp-preprocessor>#define =
STRICT</SPAN>
<SPAN class=3Dcpp-preprocessor>#define WIN32_LEAN_AND_MEAN</SPAN>
<SPAN class=3Dcpp-preprocessor>#define _WTL_USE_CSTRING</SPAN>
=20
<SPAN class=3Dcpp-preprocessor>#include &lt;atlbase.h&gt;       // base =
ATL classes</SPAN>
<SPAN class=3Dcpp-preprocessor>#include &lt;atlapp.h&gt;        // base =
WTL classes</SPAN>
<SPAN class=3Dcpp-keyword>extern</SPAN> CAppModule _Module; <SPAN =
class=3Dcpp-comment>// WTL version of CComModule</SPAN>
<SPAN class=3Dcpp-preprocessor>#include &lt;atlwin.h&gt;        // ATL =
GUI classes</SPAN>
<SPAN class=3Dcpp-preprocessor>#include &lt;atlframe.h&gt;      // WTL =
frame window classes</SPAN>
<SPAN class=3Dcpp-preprocessor>#include &lt;atlmisc.h&gt;       // WTL =
utility classes like CString</SPAN>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -