Skip to content

What is there

  • Core (afx.h, afxcoll.h, afxtempl.h, afxstr.h): CObject and CRuntimeClass with dynamic creation and serialization, CString (CStringA/CStringW), the collection classes and templates, CFile, CStdioFile, CMemFile, CArchive, CTime and CTimeSpan (from atltime.h, as in MFC 7, with CFileTime and CFileTimeSpan), exceptions, and the memory diagnostics (CMemoryState, AfxCheckMemory, afxMemDF, AfxSetAllocHook, AfxDoForAllObjects and the leak report at exit).
  • Windows (afxwin.h): CWinApp, CWinThread, CWnd and message maps, command routing and idle updates, GDI objects and device contexts, standard controls (and CCheckListBox), CDialog with DDX/DDV, frames, documents and views (SDI and MDI), CScrollView, printing.
  • afxext.h: CToolBar, CStatusBar, CDialogBar, docking and floating (dock bars, CMiniFrameWnd, drag and drop, CDockState), CSplitterWnd (static and dynamic, with split boxes and shared scroll bars), CReBar (toolbars, dialog bars and other windows in its bands), CFormView, CEditView, CBitmapButton, CRectTracker.
  • afxrich.h: CRichEditView and CRichEditDoc (rich text or plain text files, formatting the selection, find and replace, printing), with OLE objects in the text through CRichEditCntrItem (Insert Object, Paste Special, the selected item). CRichEditDoc is a COleServerDoc, so a program serves its documents by overriding OnGetEmbeddedItem.
  • afxdb.h: CDatabase, CRecordset (snapshot, dynaset and forward-only, with RFX for the usual types, bookmarks and parameters, output parameters of procedures included), CRecordView and the DDX_Field functions, CDBException, CDBVariant.
  • afxoledb.h: COleDBRecordView, a form view over a CRowset from the OLE DB consumer templates (atldbcli.h) that moves with the record commands and writes the form back to the row. Windows only.
  • afxdao.h: the DAO classes over the DAO 3.6 engine (or 3.5): CDaoWorkspace, CDaoDatabase, CDaoTableDef, CDaoQueryDef, CDaoRecordset with the DFX_ functions, CDaoRecordView and the DDX_Field functions for DAO, CDaoException and the info structures.
  • afxdisp.h: automation clients (COleDispatchDriver and the variant, date, currency and safe array classes) and servers: dispatch maps on any CCmdTarget, interface maps, aggregation, COleObjectFactory with registration and licensing, AfxOleLockApp and the /Automation start, connection points (connection maps, CConnectionPoint, AfxConnectionAdvise) and type libraries (DECLARE_OLETYPELIB, IMPLEMENT_OLETYPELIB, AfxOleRegisterTypeLib).
  • afxole.h: data transfer: COleDataSource (cached and delayed data, the clipboard, DoDragDrop), COleDataObject, COleDropSource and COleDropTarget, with the CView drag and drop handlers. Containers: COleDocument (flat or compound files), COleClientItem (new, pasted, dropped, linked, static and cloned objects, verbs, drawing, the clipboard), COleStreamFile, CMonikerFile and CAsyncMonikerFile (downloads through URL monikers, which need urlmon.dll from Internet Explorer 3 or later), AfxOleSetEditMenu. Programs can include afxolecl.rc for the container messages. Servers: COleServerDoc, COleServerItem (drawing, extents, verbs, data, the clipboard), COleLinkingDoc (links to a file and to its items through monikers, the running object table and IOleItemContainer, Link Source data on the clipboard, and links to the objects a container embeds), COleTemplateServer (registration, one object per process for SDI), AfxOleRegisterServerClass, AfxOleUnregisterServerClass and AfxOleRegisterHelper (registry entries with %1 to %9 substitutions), CWinApp::RegisterShellFileTypes, and the embedded menus of SetServerInfo, with afxolesv.rc for the Update and Exit menu text. In-place activation on both sides: the container's frame takes the object's toolbars and shared menu through COleFrameHook (IOleInPlaceFrame), and the server shows its view in a COleIPFrameWnd with a COleResizeBar, from the in-place resources of SetServerInfo and CDocTemplate::CreateOleFrame.
  • afxdocob.h: Active Documents: CDocObjectServer (IOleDocument, IOleDocumentView, IOleCommandTarget, IPrint) made by COleServerDoc::GetDocObjectServer, CDocObjectServerItem, OLE command maps (BEGIN_OLECMD_MAP, ON_OLECMD and the ON_OLECMD_* entries) with COleCmdUI, which gives update handlers' state and text to QueryStatus, COleDocIPFrameWnd, whose Help popup goes into the container's Help menu, and the container's COleDocObjectItem; COleTemplateServer registers OAT_DOC_OBJECT_SERVER classes as DocObjects.
  • afxocc.h: ActiveX control containment after AfxEnableControlContainer: COleControlContainer, COleControlSite and COccManager; CWnd::CreateControl, InvokeHelper, GetProperty and SetProperty on a control's window object, whose window functions (text, styles, position, enabling, focus) go to the control; controls in dialog templates with their DLGINIT state; event sink maps (ON_EVENT, ON_EVENT_RANGE, ON_EVENT_REFLECT, ON_PROPNOTIFY) and the DDX_OC functions. Windowless controls (IOleInPlaceSiteWindowless): the container draws them in its window's WM_PAINT and passes them mouse, keyboard and focus messages. Data binding to OLE DB data source controls (DataSource) and to the older ones that make an ICursor (IVBDSC; ocdb.h declares the cursor interfaces): CWnd::BindDefaultProperty binds a control's property to a field of the current row, both ways, BindProperty gives a property the data source (or the cursor), GetDSCCursor gives its rowset or cursor, the dialog editor's bindings in DLGINIT records are made with the dialog, and ON_DSCNOTIFY (and ON_DSCNOTIFY_RANGE and _REFLECT) hears of the data source control's changes. Extended controls (IOleControlSite::GetExtendedControl): the extender properties, and the control's own through the same IDispatch.
  • afxctl.h: writing ActiveX controls: COleControl (the OLE control interfaces, in-place activation, stock properties, methods and events, ambient properties, IViewObject drawing and persistence through streams, storages and property bags), COleControlModule, event maps, verb maps (ON_OLEVERB, ON_STDOLEVERB), IPerPropertyBrowsing, IQuickActivate, GetExtendedControl, the GetControlFlags flags (windowlessActivate, clipPaintDC, canOptimizeDraw, noFlickerActivate, pointerInactive), IViewObjectEx, IPointerInactive, windowless activation (IOleInPlaceObjectWindowless and COleControl's windowless SetCapture, SetFocus, GetDC and InvalidateControl), DECLARE_OLECREATE_EX, DECLARE_OLECTLTYPE, DECLARE_PROPPAGEIDS, CFontHolder, CPictureHolder, CPropExchange and the PX_ functions (PX_Picture included), AfxOleRegisterControlClass, licensing (IClassFactory2, AfxVerifyLicFile), data path properties (CDataPathProperty, CCachedDataPathProperty, PX_DataPath), and property pages: COlePropertyPage (IPropertyPage2, made from an ordinary dialog template), the DDP_ functions, and the stock pages CColorPropPage, CFontPropPage and CPicturePropPage.
  • afxodlgs.h: the OLE dialogs over oledlg: COleInsertDialog, COlePasteSpecialDialog, COleLinksDialog, COleUpdateDialog, COleChangeIconDialog, COleConvertDialog, COleBusyDialog, COleChangeSourceDialog and COlePropertiesDialog (IOleUIObjInfo), and the COleDocument Links, Convert and Change Icon commands. COleMessageFilter, which AfxOleInit registers for the thread (AfxOleGetMessageFilter): BeginBusyState refuses new calls, and a refused call of the program's own is retried, then the Server Busy or Not Responding dialog lets the user decide.
  • afxdlgs.h: the common dialogs (file, color, font, print, page setup, find/replace), CPrintDialogEx (PrintDlgEx), and CPropertySheet/CPropertyPage, wizards included; Wizard97's watermark, header bitmap and header titles, through CPropertySheetEx and CPropertyPageEx or MFC 7's constructors on the base classes. CFileDialog in the Vista style (IFileOpenDialog / IFileSaveDialog, with its events going to the same virtuals and the IFileDialogCustomize calls as members), and CFolderPickerDialog.
  • afxdialogex.h: CDialogEx, with a background color or bitmap. afxtaskdialog.h (from afxwin.h): CTaskDialog over comctl32 6's TaskDialogIndirect, found when it runs, so the program still starts on Windows 2000 and XP; there (CTaskDialog::IsSupported is FALSE) DoModal shows the text in a message box with the common buttons.
  • afxcmn.h, afxcview.h: the common controls (CReBarCtrl, CLinkCtrl, CPagerCtrl and CDragListBox among them), CImageList, CListView, CTreeView. CButton has the comctl32 6 and Vista messages (command link notes, split button parts, the shield), CSplitButton drops down a menu, and CNetAddressCtrl wraps shell32's network address control. afxmt.h: synchronization objects.
  • afxinet.h: the internet classes over WinINet: CInternetSession (OpenURL, options, cookies, the status callback), CHttpConnection and CHttpFile, CFtpConnection, CFtpFileFind, CGopherConnection, CGopherFile, CGopherLocator and CGopherFileFind, CInternetFile with read and write buffers, CInternetException, AfxParseURL and AfxParseURLEx.
  • afxisapi.h: Internet Server API extensions and filters: CHttpServer with parse maps, CHttpServerContext, CHttpFilter, CHttpFilterContext, CHtmlStream, and the DLL's exported functions.
  • afxhtml.h: CHtmlView (the WebBrowser control in a view: navigation, the browser's properties and events, IDocHostUIHandler through the view's On functions) and CDHtmlDialog (a dialog whose face is an HTML page: DHTML event maps, the element functions, the DDX_DHtml functions, ActiveX controls in the page and their events, window.external) and CMultiPageDHtmlDialog (a page's own event map, from BEGIN_EMBED_DHTML_EVENT_MAP and the URL map). HTML editing in MSHTML's design mode: CHtmlEditCtrlBase's commands, CHtmlEditCtrl, CHtmlEditView with its editing command map (BEGIN_DHTMLEDITING_CMDMAP) and CHtmlEditDoc. atlcomcli.h has the CComPtr, CComQIPtr, CComBSTR and CComVariant their members use.
  • ATL, for COM servers and objects (atlbase.h, atlcom.h): CComModule (ATL 3, with an object map) and CAtlDllModuleT and CAtlExeModuleT (ATL 7, with OBJECT_ENTRY_AUTO); the registrar that runs .rgs scripts from REGISTRY resources (with %MODULE% and replacement maps) and CRegKey; CComObjectRootEx and the threading models; CComObject, CComObjectNoLock, CComObjectCached, CComObjectGlobal, CComObjectStack, CComAggObject, CComPolyObject, CComContainedObject, tear-offs and cached tear-offs; BEGIN_COM_MAP with the COM_INTERFACE_ENTRY forms (2, IID, IMPL, FUNC, TEAR_OFF, CACHED_TEAR_OFF, AGGREGATE, AUTOAGGREGATE, CHAIN, NOINTERFACE, the blind ones); the creators and the DECLARE_*AGGREGATABLE macros; CComClassFactory, CComClassFactory2 (licensing) and the singleton factory; CComCoClass with Error and CreateInstance; the DECLARE_REGISTRY forms and the category map; IDispatchImpl over a registered type library (or the module's own), ISupportErrorInfoImpl and AtlReportError, IProvideClassInfo2Impl; IConnectionPointImpl, IConnectionPointContainerImpl and the connection point map, CComDynamicUnkArray and CComUnkArray; CComEnum and CComEnumOnSTL with the _Copy policies; IObjectWithSiteImpl and IObjectSafetyImpl. atlimpl.cpp is there, empty, for the ATL 3 programs that include it.
  • ATL's windows (atlwin.h): CWindow and its wrappers; message maps (BEGIN_MSG_MAP, ALT_MSG_MAP, the MESSAGE_, COMMAND_ and NOTIFY_ handlers and their ranges, CHAIN_MSG_MAP and its forms, the REFLECTED_ handlers, REFLECT_NOTIFICATIONS, FORWARD_NOTIFICATIONS, DEFAULT_REFLECTION_HANDLER); CWindowImpl over its own window class (DECLARE_WND_CLASS, DECLARE_WND_CLASS_EX) or a superclass (DECLARE_WND_SUPERCLASS), with the window procedure thunks of x86 and x86-64, SubclassWindow and OnFinalMessage; the CWinTraits styles; CContainedWindow; CDialogImpl and CSimpleDialog.
  • ATL's utilities: atlstr.h (CString, CStringA and CStringW for programs without MFC, and CAtlString for any; the same CStringT as MFC's, over string traits of ATL's own); atlsimpcoll.h (CSimpleArray, CSimpleValArray, CSimpleMap) and atlcoll.h (CAtlArray, CAtlList, CAtlMap, CRBMap, CRBMultiMap, CAutoPtrArray, CAutoPtrList, CInterfaceArray, CInterfaceList and the element traits, CElementTraits and CStringElementTraits among them); atlalloc.h (the allocators, CHeapPtr, CComHeapPtr, CTempBuffer, CAutoPtr, CAutoVectorPtr, CHandle, AtlAdd and AtlMultiply); atlexcept.h (CAtlException and AtlThrow, which throws MFC's exceptions when MFC is in use); atlsafe.h (CComSafeArray, CComSafeArrayBound); atlfile.h (CAtlFile, CAtlTemporaryFile, CAtlFileMapping); CComPtr's helpers and CComDispatchDriver; atltime.h (CTime, CTimeSpan, CFileTime, CFileTimeSpan); atlcomtime.h (COleDateTime and COleDateTimeSpan, which MFC's afxdisp.h takes from here); atlsync.h (CCriticalSection, CEvent, CMutex, CSemaphore and CMutexLock, in namespace ATL only, as MFC has its own of the same names); atlenc.h (Base64, UUEncode, quoted-printable, hex, BEncode, EscapeXML and AtlUnicodeToUTF8); atlcrypt.h (CCryptProv, CCryptHash and the MD5, SHA and HMAC hashes, CCryptKey and the derived, random, imported and user keys); atlsocket.h (CSocketAddr over getaddrinfo); atlrx.h (CAtlRegExp and CAtlREMatchContext, ATL's syntax with {} for match groups); atlutil.h (CUrl, AtlEscapeUrl, AtlUnescapeUrl, AtlCanonicalizeUrl, AtlCombineUrl, AtlGetErrorDescription, the thread traits, CWorkerThread and CThreadPool); atldbcli.h (the OLE DB consumer templates: CDataSource, CSession with transactions, CTable, CCommand with parameters and multiple results, CAccessor over BEGIN_COLUMN_MAP, BEGIN_ACCESSOR_MAP and BEGIN_PARAM_MAP classes with DEFINE_COMMAND, CDynamicAccessor, CDynamicStringAccessor, CManualAccessor, CNoAccessor, CRowset and CNoRowset, CDBPropSet, CDBPropIDSet and CDBErrorInfo; Windows only); atlimage.h (CImage: DIB sections made, attached and drawn with BitBlt, StretchBlt, AlphaBlend, TransparentBlt, MaskBlt and PlgBlt, and BMP, GIF, JPEG, PNG and TIFF read and written through GDI+, which starts on first use; an image with an alpha channel keeps it unpremultiplied, as Visual C++'s does); atlpath.h (CPath, CPathA, CPathW and the ATLPath functions over shlwapi); atlsecurity.h (CSid and Sids, CAcl, CDacl, CSacl, CSecurityDesc, CSecurityAttributes, CAccessToken, and AtlGetDacl, AtlSetDacl, AtlGetOwnerSid and AtlSetOwnerSid); and CAtlServiceModuleT, a service that is also a COM server.
  • ATL's controls (atlctl.h): CComControl and CComControlBase (windowed and windowless, in-place activation, drawing through OnDraw, ambient properties, FireOnChanged and FireOnRequestEdit, DoVerbProperties); IOleObjectImpl, IOleInPlaceObjectWindowlessImpl, IOleInPlaceActiveObjectImpl, IOleControlImpl, IViewObjectExImpl, IQuickActivateImpl, IDataObjectImpl, IRunnableObjectImpl, IPointerInactiveImpl, IPerPropertyBrowsingImpl, ISpecifyPropertyPagesImpl and IPropertyNotifySinkCP; CStockPropImpl (the stock properties the class has members for); IPropertyPageImpl; CComCompositeControl. The property map (BEGIN_PROP_MAP, PROP_ENTRY, PROP_ENTRY_EX, PROP_DATA_ENTRY, PROP_PAGE) behind IPersistStreamInitImpl, IPersistStorageImpl and IPersistPropertyBagImpl, in ATL's stream format.
  • ATL's event sinks (atlcom.h): IDispEventImpl (the handlers' types from the type library) and IDispEventSimpleImpl (from _ATL_FUNC_INFO), BEGIN_SINK_MAP with SINK_ENTRY, SINK_ENTRY_EX and SINK_ENTRY_INFO, AtlAdviseSinkMap. Handlers are named &CMyDlg::OnClick; with clang-retro's compiler also by plain name, as Visual C++ 6 code does.
  • ATL's control host (atlhost.h, atliface.h): the AtlAxWin window classes (and AtlAxWinLic, and the versioned names, AtlAxWin71 to AtlAxWin140), which make a control from a CLSID, a ProgID, a URL (the WebBrowser control) or MSHTML: text; IAxWinHostWindow and IAxWinAmbientDispatch; CAxWindow and CAxWindow2; AtlAxCreateControl and its forms, AtlAxAttachControl, AtlAxGetHost and AtlAxGetControl; AtlAxDialogBox, AtlAxCreateDialog and CAxDialogImpl, which turn a dialog's ActiveX items into host windows and give them their DLGINIT state; CWindow::GetDlgControl and GetDlgHost.

WTL

WTL (the Windows Template Library, under the MS-PL) builds on this ATL. It is not part of this repository: tools/fetch-wtl.sh [dir] downloads WTL 10.01 from NuGet, checks it against a pinned SHA-256, and puts its headers in dir/include (build/wtl/include by default). WTL wants what Visual C++ gives it:

  • -fms-compatibility (WTL uses __if_exists and Visual C++'s array rules). On a MinGW target, stock clang then stops defining __GNUC__, which MinGW-w64's headers need, so add -fgnuc-version=4.2.1 too. WTL programs are built with both: -fms-compatibility -fgnuc-version=4.2.1.
  • _MSC_VER of at least 1400 while atlapp.h is read, and only then: defined for the whole program, it would change what libc++ and the C headers do. tests/wtltest.cpp shows the way: #define _MSC_VER 1400, #include <atlapp.h>, #undef _MSC_VER.
  • WINVER and _WIN32_WINNT 0x0501 and _WIN32_IE 0x0600 or more.
  • atlstr.h included before WTL's headers, for the CString overloads.

On Linux and macOS, WTL builds with -fms-compatibility -fms-compatibility-version=19.29, and res2cpp.py needs WTL's include directory (-I build/wtl/include) for resources that include its headers. A dialog template WTL builds in memory (CIndirectDialogImpl) writes its text as WCHAR, which is 32 bits there; the dialog functions read such a template too.

What WTL needs from ATL is here: _ATL_VER is 0x0800 (ATL 8, Visual C++ 2005, unless a program defines another), ATL::Checked (the _s string functions, made to throw as ATL's do, in atlchecked.h), ATLVERIFY, ATLENSURE and ATLTRY, the trace categories (CTraceCategory, atlTraceUI and the others), _AtlWinModule in atlbase.h, _DialogSplitHelper, and atlhost.h from atlwin.h (define _ATL_NO_HOSTING to leave it out), as in ATL.