?? wtl for mfc programmers, part iv.mht
字號:
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/wtl4mfc4.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%2Fwtl4mfc4%2Easp&guid=3DWTL4MFC4%2Fwtl4%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=
FC4%2Fwtl4%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=
l4mfc4.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=
l4mfc4.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> </TD></TR>
<TR>
<TD>
<CENTER><A=20
=
href=3D"http://www.codeproject.com/script/admentor/admentorredir.asp?id=3D=
171&way=3Dban"=20
target=3D_blank><IMG height=3D600=20
alt=3D"MSDN Magazine - Your guide to Microsoft tools, =
development environments, and technologies for Windows and the Web."=20
=
src=3D"http://www.codeproject.com/script/admentor/images/mm120_600_codepr=
ot3.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>46 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
8.13</A>. Rating: <B>4.89</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/WTL4MFC4/WTL4MFC4_demo.zip">Downlo=
ad=20
demo project - 48 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/wtl4mfc4.asp#intro">Introduction</=
A>=20
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#refresher">Refresher =
on ATL Dialogs</A>=20
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#ccwrappers">Common=20
Control Wrappers</A>=20
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#appwizard">Creating =
a=20
Dialog-Based App with the AppWizard</A>=20
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#usingwrap">Using the =
Control Wrapper Classes</A>=20
<UL>
<LI><A =
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#atl1">ATL Way=20
1 - Attaching a CWindow</A>=20
<LI><A =
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#atl2">ATL Way=20
2 - CContainedWindow</A>=20
<LI><A =
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#atl3">ATL Way=20
3 - Subclassing</A>=20
<LI><A =
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#wtlway">The=20
WTL Way - DDX</A> </LI></UL>
<LI><A =
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#moreddx">More=20
on DDX</A>=20
<UL>
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#ddxmacros">DDX=20
macros</A>=20
<LI><A =
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#moreddx">More=20
about DoDataExchange()</A>=20
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#usingddx">Using=20
DDX</A> </LI></UL>
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#handlenotify">Handlin=
g=20
Notifications from Controls</A>=20
<UL>
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#handleinparent">Handi=
ng=20
notifications in the parent</A>=20
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#reflnotify">Reflectin=
g=20
Notifications</A>=20
<UL>
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#wtlreflmacros">WTL=20
macros for handling reflected messages</A> =
</LI></UL></LI></UL>
<LI><A =
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#oddsends">Odds=20
& Ends</A>=20
<UL>
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#dlgfonts">Dialog=20
Fonts</A>=20
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#atlmincrt">_ATL_MIN_C=
RT</A>=20
</LI></UL>
<LI><A=20
=
href=3D"http://www.codeproject.com/wtl/wtl4mfc4.asp#revisionhistory">Revi=
sion=20
History</A> </LI></UL>
<H2><A name=3Dintro></A>Introduction to Part IV</H2>
<P>Dialogs and controls are one area where MFC really saves you =
time and=20
effort. Without MFC's control classes, you'd be stuck filling in =
structs=20
and writing tons of <CODE>SendMessage</CODE> calls to manage =
controls. MFC=20
also provides dialog data exchange (DDX), which transfers data =
between=20
controls and variables. WTL supports all those features as well, =
and adds=20
some more improvements in its common control wrappers. In this =
article=20
we'll look at a dialog-based app that demonstrates the MFC =
features that=20
you're used to, as well as some more WTL message-handling =
enhancements.=20
Advanced UI features and new controls in WTL will be covered in =
Part=20
V.</P>
<H2><A name=3Drefresher></A>Refresher on ATL Dialogs</H2>
<P>Recall from <A =
href=3D"http://www.codeproject.com/wtl/wtl4mfc1.asp">Part=20
I</A> that ATL has two dialog classes, <CODE>CDialogImpl</CODE> =
and=20
<CODE>CAxDialogImpl</CODE>. <CODE>CAxDialogImpl</CODE> is used for =
dialogs=20
that host ActiveX controls. We won't cover ActiveX controls in =
this=20
article, so the sample code uses <CODE>CDialogImpl</CODE>.</P>
<P>To create a new dialog class, you do three things:</P>
<OL>
<LI>Create the dialog resource=20
<LI>Write a new class derived from <CODE>CDialogImpl</CODE>=20
<LI>Create a public member variable called <CODE>IDD</CODE>, and =
set it=20
to the dialog's resource ID. </LI></OL>
<P>Then you can add message handlers just like in a frame window. =
WTL=20
doesn't change that process, but it does add other features that =
you can=20
use in dialogs.</P>
<H2><A name=3Dccwrappers></A>Control Wrapper Classes</H2>
<P>WTL has lots of control wrappers which should be familiar to =
you=20
because the WTL classes are usually named the same (or almost the =
same) as=20
their MFC counterparts. The methods are usually named the same as =
well, so=20
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -