WTL Headers Quick Overview


Open-mouthed smile


It includes among its header files the following : limits.h, commctrl.h, atlres.h, atlwinx.h, atluser.h, atlgdi.h, and it makes sure that ATL secure string implementation is defined if current ATL version is greater or equal to  version 0x0900.  It also have a few utilities that we can leverage when building our apps.


   : HFONT AtlGetDefaultGuiFont(), HFONT AtlCreateBoldFont(HFONT hFont = NULL), BOOL AtlInitCommonControls(DWORD dwFlags), HINSTANCE GetModuleInstance(), HINSTANCE GetResourceInstance(), void AddCreateWndData(ATL::_AtlCreateWndData* pData, void* pObject), void* ExtractCreateWndData().  SecureHelper namespace has a few secure/safe string functions. MinCrtHelper defines wrappers for isspace, isdigit,  alphatoInt and _tcsrchr. overloads of AtlGetDllVersion(),  AtlGetCommCtrlVersion, AtlGetShellVersion


  CMessageFilter, CIdleHandler

concrete classes:

CmessageLoog, CTempBuffer ::> a safe way to allocate a number of object on the stack. CTempBuffer is template base.  CAppModule, CRegKeyEx, CServerAppModule for the COM server developers,


  has a few macros to shorten COMMAND chaining declaration and defines macros for reflection notification. if you are wondering what reflection notification is all about, its just a mechanism to forward child control messages destined for the parent to be sent back to the child.  I hopes that clears it up; if not ATL Internals is a great helper.


defines CSize, CPoint, CRect.  CRect has lots of flexibilities built into it. CString covers lots of ground including even common CRT functionalities. CFindFile provides an easy to use object oriented approach to win32 file search api. CRecentDocumentList makes dealing with MRU a breeze; just take a look at the header for yourself.  There are also a few wrappers around GetStockObject that alleviate us from having to cast when we retrieve a dependent resource such HFONT, or HPALLETTE etc…


this is where WTL introduces its magic on the GUI scene.  It defines defaults styles for the toolbar, rebar.  CHAIN_CLIENT_COMMANDS() forwards all messages to the member m_hWndClient if it is present. It has class definition for CFrameWindowImpl, COwnerDraw, CUpdateUI, and CDialogResize among many other.


Wraps common native windows controls in an Object oriented manner.  I find it useful to keep MSDN close by to know exactly how to work with them and understand the savings they offer.


Provides nice additional controls not provided by the native common controls.  Here is the list  copied pasted directly from Source:

// CBitmapButtonImpl<T, TBase, TWinTraits>
// CBitmapButton
// CCheckListViewCtrlImpl<T, TBase, TWinTraits>
// CCheckListViewCtrl
// CHyperLinkImpl<T, TBase, TWinTraits>
// CHyperLink
// CWaitCursor
// CCustomWaitCursor
// CMultiPaneStatusBarCtrlImpl<T, TBase>
// CMultiPaneStatusBarCtrl
// CPaneContainerImpl<T, TBase, TWinTraits>
// CPaneContainer
// CSortListViewImpl<T>
// CSortListViewCtrlImpl<T, TBase, TWinTraits>
// CSortListViewCtrl
// CTabViewImpl<T, TBase, TWinTraits>
// CTabView


shields us from having to implement IUIApplication and IUICommandHandler in our apps, and instead give us the familiar ATL way of handling command, messages and notifications via message mapping macros.  To be more specific, we have to use Command_Handler for the simple ribbon controls like buttons, checkboxes, toggleButtons; but the gallery controls require RIBBON_GALLERY_CONTROL_HANDLER, or the more specialized RIBBON_COMBO_CONTROL_HANDLER, RIBBON_FONT_CONTROL_HANDLER, RIBBON_COLOR_CONTROL_HANDLER, RIBBON_SPINNER_CONTROL_HANDLER, RIBBON_FLOATSPINNER_CONTROL_HANDLER  depending on the situation.  All we have to do, is inherit our top/main window from CRibbonFrameWindowImpl<>, and set its member variable m_hWndClient to our defined control that should fill the client area; WTL will handle updating the client CRECT for us as usual .  atlribbon.h also load dwm.h in our memory spaceParty smile.


has made handling events (windows messages, commands and notifications) rather easy.  Thanks WTL.  it even has a macro declaration for handling mouse double click and mouse wheel among many others. best keep it close by when developing.

Please do not limit thyself to this; further your exploration of WTL header files.  Its definitely a joy! nice, polished, and well written native code.Open-mouthed smile


Get every new post delivered to your Inbox.