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
转载请注明出处!