WTL for MFC Programmers
从MFC到WTL
原著 Michael Dunn
编译 蜗牛手记
译前序
一直以来都是在MFC的平台上开发,忽然有一天开发的东西需要跨入没有MFC的平台上才发现Window编程和MFC编程的区别,如何能够快速的由MFC转入WINDOW平台呢,找来找去发现了WTL这个奇怪的东西。
说它奇怪,一点也不过分,微软开发的开放原码的东西,没有官方的任何资源,版本也怪,第一版是3.1,都说微软的东西要到3.0以后才能用,windows是,IE是,window ce也是,难道为了说明自己第一版就能用,所以直接就着这么定义了?当然是开玩笑,至于为什么,文中自有答案。
本文原文刊登在http://www.codeproject.com,通读以后觉得行文稍显啰嗦,但是一步一步的讲解的非常清楚易懂,很多地方还和MFC相互例证,使读者在学习WTL的同时了解MFC的运行情况。
由于本人水平有限,所以采用英汉对应的方法,便于读者在发现中文行文问题时对照原文理解。
蜗牛手记
http://www.chinaos.com
关于作者Michael Dunn
Michael lives in sunny Los Angeles, California, and is so spoiled by the weather that he will probably never be able to live anywhere else. He started programming with an Apple //e in 4th grade, graduated from UCLA with a math degree in 1995, and immediately landed a job as a QA engineer at Symantec, working on the Norton AntiVirus team. He pretty much taught himself Windows and MFC programming, and in 1999 he designed and coded a new interface for Norton AntiVirus 2000.Mike now works as a developer at Napster, an online subscription music service. He also developed UltraBar, an IE toolbar plugin that makes web searching easy and trounces the Google toolbar; the CodeProject SearchBar; and has co-founded Zabersoft, a development company with offices in Los Angeles and Odense, Denmark.
He also enjoys his hobbies of playing pinball, bike riding, and the occasional PlayStation, Dreamcast, or MAME game. He is also sad that he's forgotten the languages he's studied: French, Mandarin Chinese, and Japanese.
Part I - ATL GUI Classes
第一章 ATL的GUI类
An introduction to WTL programming for MFC developers
一个适用于MFC程序员的WTL入门
README.TXT
阅读须知
This is the stuff I want you to read first, before proceeding on or posting messages to this article's discussion board.
我希望你在开始阅读或讨论这篇文章之前,能先读以下的信息。
You need the Platform SDK. You can't use WTL without it. You can use the online SDK Update site, or download the CAB files and run the setup locally. Be sure you use the utility to add the SDK include and lib directories to the VC search path. You can find this in the Visual Studio Registration folder in the Platform SDK program group.
你需要Platform SDK,没有它WTL无法运行。你可以在线使用SDK Update网站,或者下载cab文件到本地安装。请确定你在VC的搜索路径中添加了有效的SDK的include和lib路径。你可以在Platform SDK的程序组的Visual Studio Registration中找到这些路径的信息。
You need WTL. Download version 7 from Microsoft. See the articles "Introduction to WTL - Part 1" and "Easy installation of WTL" for some tips on installing the files. Those articles are rather out-of-date now, but still contain some good info. One thing which I don't think is mentioned in those articles is how to tell VC to search the WTL include directory. In VC 6, click Tools|Options and go to the Directories tab. In the Show directories for combo box, select Include files. Then add a new entry that points to the directory where you put the WTL header files.
你需要WTL。从微软的网站下载WTL 7。阅读文章本文后面的部分来安装这些文件。然后你需要在VC的搜索路径中添加WTL的include目录。在VC6中,点击菜单项Tools|Options,然后寻找Directories页。在标签为Show directories for:的组合框中选择Include files。然后添加WTL头文件路径到下面的列表中。
You need to know MFC, and know it well enough that you understand what's behind the message map macros, and can edit the code marked "DO NOT EDIT" with no problems.
你需要了解MFC的消息宏的运作方式,还应该能够编辑被标注了“DO NOT EDIT”的代码。
You need to know Win32 API programming, and know it well. If you learned Windows programming by going straight into MFC, without learning how messages work at the API level, you are unfortunately going to have trouble in WTL. If you don't know what a message's WPARAM and LPARAM mean, you should read other articles (there are lots of them here at CodeProject) so you understand.
你需要了解一些Win32 API编程的知识,如果你只学习MFC来进行Windows编程,而不了解API级别的消息处理机制,很不幸,你在学习WTL的进程中将遇到不少麻烦。如果你不知道消息中WPARM和LPARAM的含义,你需要一起其他的相关的资料作为参考。
You need to know C++ template syntax. See the VC Forum FAQ for links to C++ FAQs and template FAQs.
你需要知道c++模板的语法。访问http://www.codeproject.com/cpp/cppforumfaq.asp#other_cpp 去了解更多的关于这方面的知识。
I will only be covering VC 6 features, but as far as I know everything should work on VC 7. Since I don't use VC 7, I won't be able to help with VC 7 problems. However, feel free to post VC 7 questions, as other readers might be able to help.
我将只讲述VC6相关的特性,虽然我知道在不远的将来所有的工作将在VC7上进行,但是我还没有使用VC7,所以无法提供相关的帮助。然而,你也可以贴出VC7相关的问题,也许其他的读者能够提供帮助。