WTL for MFC Programmers(1)
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
原著 Michael Dunn
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
Michael lives in sunny <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />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
An introduction to WTL programming for MFC developers
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.
You need to know C++ template syntax. See the VC Forum FAQ for links to C++ FAQs and template FAQs.
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.