

Java技术
2005: 03 04 05 06 07 08
09 10 11 12
2006: 01 02
Asp.net
2005: 07 08 09 10 11 12
2006: 01 02

WTL rocks. It does. It has a lot of the power of MFC´s GUI classes, yet produces substantially smaller executables. If you´re like me, and learned GUI programming with MFC, you´ve become quite comfortable with all the control wrappers MFC provides, as well as with the flexible message handling built into MFC. If you´re also like me and don´t relish the idea of several hundred K of MFC framework getting added to your programs, WTL is for you. However, there are a few barriers we have to overcome:
WTL有类似MFC那样的GUI类的功能,也能够产生足够小的可执行文件。如果你像我使用MFC来进行GUI编程,你已经非常习惯的使用MFC封装的控件,灵活的使用MFC提供的消息方式;如果你像我,不希望MFC数百K的框架程序随你的程序发布,那么WTL将适合你。然而,我们还须克服一些困难:
On the other hand, the benefits of WTL are:
另一方面,WTL的优点是:
In this series, I will first introduce the ATL windowing classes. WTL is, after all, a set of add-on classes to ATL, so a good understanding of ATL windowing is essential. Once I´ve covered that, I´ll introduce WTL features and show how they make GUI programming a lot easier.
在这个系列,我将首先介绍ATL的窗体类。由于WTL实际是一套ATL的扩展类,所以充分的了解ATL窗体类很重要。在此之后,我将介绍WTL的特性和如何使用他们来简化GUI编程。
WTL rocks. But before we get to why, we need to cover ATL first. WTL is 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; the detour into ATL is necessary.
在我们了解WTL之前,我们需要先了解ATL。由于WTL是一套ATL的扩展类,而且如果你以前是一个完全的MFC程序员的话,你可能从没有接触过ATL GUI类。所以请原谅我没有直接讲述WTL,因为绕道ATL很重要。
In this first part, I will give a little background on ATL, cover some essential points you need to know before writing ATL code, quickly explain those funky ATL templates, and cover the basic ATL windowing classes.
在第一部分,我将给出一点ATL的知识,讲述一些在写ATL代码前你需要知道的基础要点,快速的说明那些让人心惊胆战的ATL模板,并揭示基本的ATL窗体类。
The Active Template Library... kind of an odd name, isn´t it? Old-timers might remember that it was originally the ActiveX Template Library, which is a more accurate name, since ATL´s goal is to make writing COM objects and ActiveX controls easier. (ATL was also developed during the time that Microsoft was naming new products ActiveX-something, just as new products nowadays are called something.NET.) Since ATL is really about writing COM objects, it only has the most basic of GUI classes, the equivalent of MFC´s CWnd and CDialog. Fortunately, the GUI classes are flexible enough to allow for something like WTL to be built on top of them.
Active Template Library(活动模板库)似乎不像一个固定的名字,它的更确切的名字应该是ActiveX Templeate Library。最初是用来简化COM和ActiveX编程的(在ATL开发期间,微软的新产品叫作ActiveX,而现在这个产品叫作.NET)当ATL真正的应用在COM编程以后,他只提供了最基础的GUI类,就像MFC的CWnd和CDialog。幸运的是,这些GUI的灵活性已经足够在其上建立像WTL这样的类库了。
WTL is currently in its second revision. The first was version 3.1, and the second is version 7. (The version numbers were chosen to match the ATL version numbers, that´s why they´re not 1 and 2.) Version 3.1 works with VC 6 and VC 7, although you need to define a couple of preprocessor symbols for VC 7. WTL version 7 is a drop-in replacement for version 3.1, and works without modification on VC 7, so there really is no reason to use 3.1 for new development.
WTL的当前版本是他的第2个版本。第一个版本是3.1,第2个版本是7。(这个版本是跟随ATL的版本号定义的,并不是连续的)3.1版可以工作在VC6和VC7上,不过需要为VC7定义一对预处理程序标识。WTL 7版在3.1版基础上进行了提升,在VC7上部需要作任何改动,所以没有任何理由再使用3.1版开发新的程序了。
(现在WTL的最新版为7.1 --- 蜗牛手记)