雅虎NCP

[登录] 雅虎首页 NCP首页 帮助中心

程序员驿站

程序员吧

WTL8.0初探(一)

2007-11-26 10:14:25 | 发布人:王卫星 | 点击:219 | 第1页/共1页 << 上一页|下一页 >>

WTL(Windows Template Library),我自己叫他“窗口模板库”,它其实是ATL的一个扩展,ATL仅仅给我们提供了一些简单的窗口类, 以前写ActiveX控件写点界面还真是很难,现在有了它不用发愁了。WTL是都是模板所以效率高体积小,现在越来越多的人都在用它。WTL不仅封装了通 用的窗口和控件,而且把GDI也向MFC一样封装了一遍,但是和MFC不同的是,WTL封装的这套GDI类底层画法不仅仅使只用gdi的api,它竟然还 用到了OpenGL,那天我在源代码中发现了一些OpenGL库的引用使我惊奇万分?至于为什么要这么做,我还没有找到确切的答案。
下面是AtlGdi.h的一段代码:
// required libraries
#if !defined(_ATL_NO_MSIMG) && !defined(_WIN32_WCE)
  #pragma comment(lib, "msimg32.lib")
#endif // !defined(_ATL_NO_MSIMG) && !defined(_WIN32_WCE)
#if !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE)
  #pragma comment(lib, "opengl32.lib")                                                                  //这里加上了OpenGL的库
#endif // !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE)

//看看下面的类名是不是很熟悉呢?hoho
///////////////////////////////////////////////////////////////////////////////
// Classes in this file:
//
// CPenT<t_bManaged>
// CBrushT<t_bManaged>
// CLogFont
// CFontT<t_bManaged>
// CBitmapT<t_bManaged>
// CPaletteT<t_bManaged>
// CRgnT<t_bManaged>
// CDCT<t_bManaged>
// CPaintDC
// CClientDC
// CWindowDC
// CMemoryDC
// CEnhMetaFileInfo
// CEnhMetaFileT<t_bManaged>
// CEnhMetaFileDC
//
// Global functions:
//   AtlGetBitmapResourceInfo()
//   AtlGetBitmapResourceBitsPerPixel()
//   AtlIsAlphaBitmapResource()
//   AtlIsDib16()
//   AtlGetDibColorTableSize()
//   AtlGetDibNumColors(),
//   AtlGetDibBitmap()
//   AtlCopyBitmap()
//   AtlCreatePackedDib16()
//   AtlSetClipboardDib16()
//   AtlGetClipboardDib()

WTL8.0一共只有19个头文件
    atlapp.h message loop, interfaces, general app stuff
    atlcrack.h message cracker macros
    atlctrls.h standard and common control classes
    atlctrlw.h command bar class
    atlctrlx.h bitmap button, check list view, and other controls
    atlddx.h data exchange for dialogs and windows
    atldlgs.h common dialog classes, property sheet and page classes
    atlframe.h frame window classes, MDI, update UI classes
    atlgdi.h DC classes, GDI object classes
    atlmisc.h WTL ports of CPoint, CRect, CSize, CString, etc.
    atlprint.h printing and print preview
    atlres.h standard resource IDs
    atlresce.h standard resource IDs for Windows CE
    atlscrl.h scrollable windows
    atlsplit.h splitter windows
    atltheme.h Windows XP theme classes
    atluser.h menu class, USER object classes
    atlwince.h specific support for Windows CE
    atlwinx.h extensions of ATL windowing support
 

上面这些东西,对我们来说已经够用了,一些关于窗口和控件的封装代码写的很简单就是每个方法对应一个api或者消息,如果我们认真的去读它的代码也会有不少收益,以后我会跳一些好的代码分析一下.

WTL8.0 提供了向导,用法很简单下载一个WTL8.0的库,里面都带着AppWiz,在AppWiz\目录下双击相应的向导js就可以了。

作者:wangweixing2000
转载请注明出处!
评论:0   好评:0   坏评:0    
最新评论
标题 作者 发布时间
发表评论 [您必须登录后才能发表评论]
  [登录]  新用户?[注册]

广告

广告

关于雅虎|帮助中心|联系我们|诚聘英才|广告服务|搜索竞价|雅虎百业窗|网站联盟|雅虎大全
Copyright ©2008 Yahoo.com.cn 版权所有 不得转载 使用须知著作权声明NCP法律声明