WTL for MFC Programmers(1)

WTL 专栏收录该内容
7 篇文章 0 订阅

WTL for MFC Programmers

MFCWTL

 

原著 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

第一章 ATLGUI

 

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的搜索路径中添加了有效的SDKincludelib路径。你可以在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的搜索路径中添加WTLinclude目录。在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的进程中将遇到不少麻烦。如果你不知道消息中WPARMLPARAM的含义,你需要一起其他的相关的资料作为参考。

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相关的问题,也许其他的读者能够提供帮助。

  • 0
    点赞
  • 1
    评论
  • 1
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

相关推荐
下面是网络收集 WTL for MFC Programmers, Chinese Version Prologue WTL for MFC Programmers, Part I - ATL GUI Classes - WTL WTL for MFC Programmers, Part II - WTL GUI Base Classes - WTL WTL for MFC Programmers, Part III - Toolbars and Status Bars - WTL WTL for MFC Programmers, Part IV - Dialogs and Controls - WTL WTL for MFC Programmers, Part IX - GDI Classes, Common Dialogs, and Utility Classes - WTL WTL for MFC Programmers, Part V - Advanced Dialog UI Classes - WTL WTL for MFC Programmers, Part VI - Hosting ActiveX Controls - WTL WTL for MFC Programmers, Part VII - Splitter Windows - WTL WTL for MFC Programmers, Part VIII - Property Sheets and Wizard 由于工作的需要经常开发一些COM组件,在要求不能使用MFC的场合就是用ATL。ATL提供了对窗口的面向对象地封装和简单的消息映射机制,但是ATL过于简单,用它开发应用程序几乎不可能。要想让ATL具备界面框架解决方案的功能还需要做很多事情,幸运的是WTL就做了这些事情。WTL是个很奇特的东西,它由微软公司一群热情的程序员维护,它从未出现在微软的官方产品名单上,但可以从微软的官方网站下载最新的WTL。它没有正式的文档支持,用WTL做关键字在MSDN中检索只能得到0个结果,但是全世界的开发网站上都有针对WTL的讨论组和邮件列表,任何问题都会得到热情的解答。我认真地对比了MFCWTL,发现二者有很多相通之处,MFC的功能几乎都能在WTL中实现,只是方法不同而已。我几乎不费吹灰之力就将以前写的一个MFC程序用WTL改写了,使用静态链接的WTL程序比使用动态链接的MFC程序还要小,资源占用只有MFC程序的一半。 但是一时的热情不能解决文档缺乏的困扰,虽然网上有很多使用WTL的例子和说明文章,几乎把MFC能实现的各种稀奇古怪的效果都实现了,但都是着眼于局部问题得解决,缺乏系统地全面地介绍WTL的文章。就在这个时候我看到了迈克尔.敦(Michael Dunn)的“WTL for MFC Programmers”系列文章,我的感觉和1995年我第一次见到MSDN时一样,几乎是迫不及待地将其读完,同时也萌发了将其翻译成汉语的冲动。于是给Michael写了封邮件,希望能够得到授权将他的文章翻译成汉语(事实上在这之前我已经翻译了两章了)。在得到授权确认后才发现这个工作是多么的困难,但为时已晚,只能硬着头皮撑下去。
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值