How to make small statically linked MFC EXEs in Visual C++ 2010

As a followup to my previous blog entry, I’ve decided to make a simple workaround for those users that want to create a statically linked MFC EXE in 2010 with a size comparable to what was possible in 2008 SP1, that is, a size around 600K instead of the 1800K that you’d get by creating a simple MFC SDI app with classic menus, native/default look and feel, and classic docking toolbars.

It turns out that there are only three source files from the “classic” MFC source code with dependencies on the feature pack source code, that is causing it all to be pulled in when linking. If we can modify this source code by including these three files in our projects, by removing references to the feature pack source code, then the generated EXE size drops dramatically to 600K.

And of course, we must make sure that we do not use any of the feature pack classes, because as soon as you pull one in, you get most of it linked in. I’m specifcally alluding to CDialogEx. CDialogEx is the “new” base class for dialog boxes generated by the MFC appwizard, including the default generated About box. CDialogEx is relatively useless, unless you want to change the background color and/or image of your dialog box, which is something I wouldn’t recommend doing anyway. So the first thing you want to do is change any instances in your project from CDialogEx to CDialog (base classes, base method calls, etc). (a simple Find in Files will suffice)

Then, follow the directions below to get your app back to a reasonable size.

1) Create a default MFC SDI app with no special features (MFC standard, windows native/default style, classic menu, classic docking toolbar, no restart manager support) (this step is not necessary if you already have a project to play with)
2) Change to MFC static linking using project properties
3) add the following MFC source files to your project (copy them from the MFC source file folder located in the place you installed Visual Studio 2010, usually your program files\microsoft visual studio 10.0\vc\atlmfc\src\mfc into your project folder and then “add existing item” for all three files)

afxctrlcontainer.cpp
afxglobals.cpp
winmdi.cpp

4) comment out (or #if 0/#endif) the following code in the MFC source files added:

in afxctrlcontainer.cpp:
all the includes after afxctrlcontainer.h
some lines in CMFCControlContainer::CreateDlgControl
some lines in PreUnsubclassControl
the call to tagManager in ReadBoolProp

in afxglobals.cpp
all the includes after comdef.h except afxglobals.h
the loop that starts with “Notify toolbars about font changing:”
the cleanup for various items ( these will be obvious based on the errors you get compiling after removing the includes above)
the references to CPaneFrameWnd
the references to feature pack classes in AfxIsExtendedFrameClass
the reference to CMFCToolbar in AfxIsMFCToolbar

in winmdi.cpp
the two includes after sfdafx.h
the block of code in UpdateClientEdge that starts with CMDIChildWndEx

5) In your project’s stdafx.h add the following lines (these are internal MFC code that some of the source files require, you can add them to the individual source files instead of you prefer):

#include "afxpriv.h"
#include "afxole.h"
#include "..\src\mfc\oleimpl2.h"
#include "..\src\mfc\afximpl.h"

6) Remove the

#include <afxcontrolbars.h>

from the stdafx.h if applicable. And remove any references to CShellManager in your generated project.

After doing the above, recompile your release build, and notice that your generated EXE should be quite a bit smaller (around 600K instead of 1800K for the above example).

Advertisements

Statically linked release MFC EXE size in Visual C++ 2010 vs 2008

It seems that a default generated MFC EXE (statically linked) in Visual C++ 2010 is much bigger than its 2008 SP1 counterpart. Take the simplest example (has no code at all):

1) Create Win32 application (empty app)
2) Add a new CPP file test.cpp
3) enter project properteis and turn on MFC as a static library and turn off precompiled headers for test.cpp
4) in test.cpp just put one line:
#include "afxwin.h"

5) Compile the app

repeat for 2008 and 2010.

for 2008 it is 186K
for 2010 it is 1.5 Megs.

I believe this is happening because of a piece of code (not yet determined) that is causing many more global variables to be pulled into the code. Previously if a global variable existed in an OBJ and was not referred to in that module or any other it would exclude the entire module.

By setting a breakpoint in crt0dat.c where _initterm is called, you can see the names of each global variable initialized. In 2008 these are the variables initialized:

afxstate

THREAD_LOCAL(_AFX_THREAD_STATE, _afxThreadState)
PROCESS_LOCAL(_AFX_BASE_MODULE_STATE, _afxBaseModuleState)

strcore

CAfxStringMgr afxStringManager;

atlbase

CAtlBaseModule _AtlBaseModule;

appmodul

char _afxInitAppState = (char)(AfxInitialize(FALSE, _MFC_VER), atexit(&_AfxTermAppState));

except

CMemoryException _simpleMemoryException(FALSE, AFX_IDS_MEMORY_EXCEPTION);
CNotSupportedException _simpleNotSupportedException(FALSE, AFX_IDS_NOT_SUPPORTED_EXCEPTION);
CInvalidArgException _simpleInvalidArgException(FALSE, AFX_IDS_INVALID_ARG_EXCEPTION);

auxdata

AFX_DATADEF AUX_DATA afxData;

wincore

PROCESS_LOCAL(_AFX_HTMLHELP_STATE, _afxHtmlHelpState)
const UINT CWnd::m_nMsgDragList = ::RegisterWindowMessage(DRAGLISTMSGSTRING);
const AFX_DATADEF CWnd CWnd::wndTop(HWND_TOP);
const AFX_DATADEF CWnd CWnd::wndBottom(HWND_BOTTOM);
const AFX_DATADEF CWnd CWnd::wndTopMost(HWND_TOPMOST);
const AFX_DATADEF CWnd CWnd::wndNoTopMost(HWND_NOTOPMOST);

array_b

IMPLEMENT_SERIAL(CByteArray, CObject, 0)
CResourceException _simpleResourceException(FALSE, AFX_IDS_RESOURCE_EXCEPTION);
CUserException _simpleUserException(FALSE, AFX_IDS_USER_EXCEPTION);

array_o

IMPLEMENT_SERIAL(CObArray, CObject, 0)

Pretty short list.

In 2010, this is the list:
10.0:

afxstate

THREAD_LOCAL(_AFX_THREAD_STATE, _afxThreadState)
PROCESS_LOCAL(_AFX_BASE_MODULE_STATE, _afxBaseModuleState)

dlgclr

PROCESS_LOCAL(_AFX_COLOR_STATE, _afxClrState)

oledata

PROCESS_LOCAL(_AFX_OLE_STATE, _afxOleState)

winctrl3.cpp

PROCESS_LOCAL(_AFX_CHECKLIST_STATE, _afxChecklistState)

atlbase

CAtlBaseModule _AtlBaseModule;

atlimage2.cpp

CImage::CInitGDIPlus CImage::s_initGDIPlus;

atlimage.cpp

CImage::CDCCache CImage::s_cache;

appmodul

char _afxInitAppState = (char)(AfxInitialize(FALSE, _MFC_VER), atexit(&_AfxTermAppState));

except

CMemoryException _simpleMemoryException(FALSE, AFX_IDS_MEMORY_EXCEPTION);
CNotSupportedException _simpleNotSupportedException(FALSE, AFX_IDS_NOT_SUPPORTED_EXCEPTION);
CInvalidArgException _simpleInvalidArgException(FALSE, AFX_IDS_INVALID_ARG_EXCEPTION);

auxdata

AFX_DATADEF AUX_DATA afxData;

wincore

PROCESS_LOCAL(_AFX_HTMLHELP_STATE, _afxHtmlHelpState)
const UINT CWnd::m_nMsgDragList = ::RegisterWindowMessage(DRAGLISTMSGSTRING);
const AFX_DATADEF CWnd CWnd::wndTop(HWND_TOP);
const AFX_DATADEF CWnd CWnd::wndBottom(HWND_BOTTOM);
const AFX_DATADEF CWnd CWnd::wndTopMost(HWND_TOPMOST);
const AFX_DATADEF CWnd CWnd::wndNoTopMost(HWND_NOTOPMOST);

array_b

IMPLEMENT_SERIAL(CByteArray, CObject, 0)
CResourceException _simpleResourceException(FALSE, AFX_IDS_RESOURCE_EXCEPTION);
CUserException _simpleUserException(FALSE, AFX_IDS_USER_EXCEPTION);

wingdi.cpp
CResourceException _simpleResourceException(FALSE, AFX_IDS_RESOURCE_EXCEPTION);
CUserException _simpleUserException(FALSE, AFX_IDS_USER_EXCEPTION);

afxkeyboardmanager.h

static CString _afxDefaultAcceleratorDelimiter = _T("; ");

afxglobals.cpp

static const CString strOfficeFontName = _T("Tahoma");
static const CString strOffice2007FontName = _T("Segoe UI");
static const CString strDefaultFontName = _T("MS Sans Serif");
static const CString strVertFontName = _T("Arial");
static const CString strMarlettFontName = _T("Marlett");
AFX_GLOBAL_DATA afxGlobalData;

array_o

IMPLEMENT_SERIAL(CObArray, CObject, 0)

map_wo.cpp

afxshelllistctrl

UINT AFX_WM_CHANGE_CURRENT_FOLDER = ::RegisterWindowMessage(_T("AFX_WM_CHANGE_CURRENT_FOLDER"));

afxpropertygridctrl

CString CMFCPropertyGridProperty::m_strFormatChar = _T("%c");
CString CMFCPropertyGridProperty::m_strFormatShort = _T("%d");
CString CMFCPropertyGridProperty::m_strFormatLong = _T("%ld");
CString CMFCPropertyGridProperty::m_strFormatUShort = _T("%u");
CString CMFCPropertyGridProperty::m_strFormatULong = _T("%u");
CString CMFCPropertyGridProperty::m_strFormatFloat = _T("%f");
CString CMFCPropertyGridProperty::m_strFormatDouble = _T("%lf");
UINT AFX_WM_PROPERTY_CHANGED = ::RegisterWindowMessage(_T("AFX_WM_PROPERTYCHANGED"));

list_s

IMPLEMENT_SERIAL(CStringList, CObject, 0)

afxkeyboardmanager.h (again)

afxtoolbar.cpp

static const CString strToolbarProfile = _T("MFCToolBars");
UINT AFX_WM_TOOLBARMENU = ::RegisterWindowMessage(_T("TOOLBAR_POPUPMENU"));
UINT AFX_WM_CUSTOMIZETOOLBAR = ::RegisterWindowMessage(_T("TOOLBAR_CUSTOMIZE"));
UINT AFX_WM_CREATETOOLBAR = ::RegisterWindowMessage(_T("TOOLBAR_CREATE"));
UINT AFX_WM_DELETETOOLBAR = ::RegisterWindowMessage(_T("TOOLBAR_DELETE"));
UINT AFX_WM_CUSTOMIZEHELP = ::RegisterWindowMessage(_T("TOOLBAR_CUSTOMIZEHELP"));
UINT AFX_WM_RESETTOOLBAR = ::RegisterWindowMessage(_T("TOOLBAR_RESETTOOLBAR"));
UINT AFX_WM_RESETMENU = ::RegisterWindowMessage(_T("TOOLBAR_RESETMENU"));
UINT AFX_WM_SHOWREGULARMENU = ::RegisterWindowMessage(_T("TOOLBAR_SHOWREGULARMENU"));
UINT AFX_WM_RESETCONTEXTMENU = ::RegisterWindowMessage(_T("TOOLBAR_RESETCONTEXTMENU"));
UINT AFX_WM_RESETKEYBOARD = ::RegisterWindowMessage(_T("TOOLBAR_RESETKEYBAORD"));
UINT AFX_WM_RESETRPROMPT = ::RegisterWindowMessage(_T("TOOLBAR_RESETRPROMPT"));
CObList afxAllToolBars;
CMFCToolBarDropSource CMFCToolBar::m_DropSource;
CMFCToolBarImages CMFCToolBar::m_Images;
CMFCToolBarImages CMFCToolBar::m_ColdImages;
CMFCToolBarImages CMFCToolBar::m_MenuImages;
CMFCToolBarImages CMFCToolBar::m_DisabledImages;
CMFCToolBarImages CMFCToolBar::m_DisabledMenuImages;
CMFCToolBarImages CMFCToolBar::m_LargeImages;
CMFCToolBarImages CMFCToolBar::m_LargeColdImages;
CMFCToolBarImages CMFCToolBar::m_LargeDisabledImages;
CMap CMFCToolBar::m_DefaultImages;
CList CMFCToolBar::m_lstUnpermittedCommands;
CList CMFCToolBar::m_lstBasicCommands;
CMFCCmdUsageCount CMFCToolBar::m_UsageCount;
IMPLEMENT_SERIAL(CMFCToolBar, CMFCBaseToolBar, VERSIONABLE_SCHEMA | 1)

afxvisualmanageroffice2007
CString CMFCVisualManagerOffice2007::m_strStylePrefix;

afxvisualmanager
UINT AFX_WM_CHANGEVISUALMANAGER = ::RegisterWindowMessage(_T("AFX_WM_CHANGEVISUALMANAGER"));

afxkeyboardmanager.h (again)

afxkeyboardmanager.cpp
static const CString strKbProfile = _T("KeyboardManager");
CString CKeyboardManager::m_strDelimiter = _T("; ");

afxcommandmanager
static const CString strToolbarProfile = _T("ToolBars");
static _STATIC_CREATOR_ STATIC_CREATOR;

afxmenuimages
CMFCToolBarImages CMenuImages::m_ImagesBlack;
CMFCToolBarImages CMenuImages::m_ImagesDkGray;
CMFCToolBarImages CMenuImages::m_ImagesGray;
CMFCToolBarImages CMenuImages::m_ImagesLtGray;
CMFCToolBarImages CMenuImages::m_ImagesWhite;
CMFCToolBarImages CMenuImages::m_ImagesBlack2;

afxmenuhash
CMenuHash afxMenuHash;

afxpaneframewnd
UINT AFX_WM_CHECKEMPTYMINIFRAME = ::RegisterWindowMessage(_T("MSG_CHECKEMPTYMINIFRAME"));
IMPLEMENT_SERIAL(CPaneFrameWnd, CWnd, VERSIONABLE_SCHEMA | 2)
CMap CPaneFrameWnd::m_mapFloatingBars;
CList CPaneFrameWnd::m_lstFrames;

afxdockingmanager

static const CString strDockingManagerProfile = _T("DockingManagers");
CSmartDockingInfo CDockingManager::m_SDParams;

afxshellmanager
UINT AFX_WM_ON_AFTER_SHELL_COMMAND = ::RegisterWindowMessage(_T("AFX_WM_ON_AFTER_SHELL_COMMAND"));

array_s

IMPLEMENT_SERIAL(CStringArray, CObject, 0)

afxtoolbarimages
CCriticalSection CMFCToolBarImages::m_CriticalSection;
CString CMFCToolBarImages::m_strPngResType = _T("PNG");
static const _AFX_TOOLBAR_TERM toolbarTerm;

afxkeyboardmanager.h (again)

afxpopupmenu

IMPLEMENT_SERIAL(CMFCPopupMenu, CMiniFrameWnd, VERSIONABLE_SCHEMA | 1)

afxcolorbar
IMPLEMENT_SERIAL(CMFCToolBarColorButton, CMFCToolBarButton, 1)
IMPLEMENT_SERIAL(CMFCColorBar, CMFCPopupMenuBar, 1)
CMap CMFCColorBar::m_ColorNames;

afxpropertygridtooltipctrl
CString CMFCPropertyGridToolTipCtrl::m_strClassName;

afxtoolbarcomboboxbutton
IMPLEMENT_SERIAL(CMFCToolBarComboBoxButton, CMFCToolBarButton, 1)

afxkeyboardmanager.h (again)

afxwinappex
static const CString strRegEntryNameControlBars = _T("\\ControlBars");
static const CString strWindowPlacementRegSection = _T("WindowPlacement");
static const CString strRectMainKey = _T("MainWindowRect");
static const CString strFlagsKey = _T("Flags");
static const CString strShowCmdKey = _T("ShowCmd");
static const CString strRegEntryNameSizingBars = _T("\\SizingBars");
static const CString strRegEntryVersion = _T("ControlBarVersion");
static const CString strVersionMajorKey = _T("Major");
static const CString strVersionMinorKey = _T("Minor");

afxcontextmenumanager

static const CString strMenusProfile = _T("ContextMenuManager");

afxtoolbarfontcombobox
IMPLEMENT_SERIAL(CMFCToolBarFontComboBox, CMFCToolBarComboBoxButton, 1)
CObList CMFCToolBarFontComboBox::m_lstFonts;
IMPLEMENT_SERIAL(CMFCToolBarFontSizeComboBox, CMFCToolBarComboBoxButton, 1)

afxtooltipmanager
UINT AFX_WM_UPDATETOOLTIPS = ::RegisterWindowMessage(_T("AFX_WM_UPDATETOOLTIPS"));

afxkeyboardmanager.h (again)

afxframeimpl.cpp
static const CString strTearOffBarsRegEntry = _T("ControlBars-TearOff");
CList CFrameImpl::m_lstFrames;
UINT AFX_WM_POSTSETPREVIEWFRAME = ::RegisterWindowMessage(_T("AFX_WM_POSTSETPREVIEWFRAME"));

afxmdicilentareawnd

static const CString strMDIClientAreaProfile = _T("MDIClientArea");

UINT AFX_WM_ON_MOVETOTABGROUP = ::RegisterWindowMessage(_T("AFX_WM_ON_MOVETOTABGROUP"));

afxglobalutils
CGlobalUtils afxGlobalUtils;

oledoc1.cpp
IMPLEMENT_SERIAL(CDocItem, CCmdTarget, 0)

afxusertoolsmanager.cpp

static const CString strUserToolsProfile = _T("UserToolsManager");
static const CString strUserToolsEntry = _T("Tools");

afxbasepane
static const CString strBaseControlBarProfile = _T("BasePanes");
CCriticalSection CBasePane::m_CriticalSection;

afxkeyboardmanager.h (again)

afxribbonbar
UINT AFX_WM_POSTRECALCLAYOUT = ::RegisterWindowMessage(_T("AFX_WM_POSTRECALCLAYOUT"));
UINT AFX_WM_ON_CHANGE_RIBBON_CATEGORY = ::RegisterWindowMessage(_T("AFX_WM_ON_CHANGE_RIBBON_CATEGORY"));
UINT AFX_WM_ON_RIBBON_CUSTOMIZE = ::RegisterWindowMessage(_T("AFX_WM_ON_RIBBON_CUSTOMIZE"));
UINT AFX_WM_ON_HIGHLIGHT_RIBBON_LIST_ITEM = ::RegisterWindowMessage(_T("AFX_WM_ON_HIGHLIGHT_RIBBON_LIST_ITEM"));
UINT AFX_WM_ON_BEFORE_SHOW_RIBBON_ITEM_MENU = ::RegisterWindowMessage(_T("AFX_WM_ON_BEFORE_SHOW_RIBBON_ITEM_MENU"));
static const CString strRibbonProfile = _T("MFCRibbons");

afxribbonstatusbar
static const CString strRibbonProfile = _T("MFCRibbons");

afxmenubar
IMPLEMENT_SERIAL(CHelpComboBoxButton, CMFCToolBarComboBoxButton, VERSIONABLE_SCHEMA | 1)
IMPLEMENT_SERIAL(CMFCMenuBar, CMFCToolBar, VERSIONABLE_SCHEMA | 1)
static const CString strMenuProfile = _T("MenuBar");

afxtabctrl

UINT AFX_WM_ON_HSCROLL = ::RegisterWindowMessage(_T("AFX_WM_ON_HSCROLL"));
UINT AFX_WM_GETDRAGBOUNDS = ::RegisterWindowMessage(_T("AFX_WM_GETDRAGBOUNDS"));
UINT AFX_WM_ON_DRAGCOMPLETE = ::RegisterWindowMessage(_T("AFX_WM_ON_DRAGCOMPLETE"));
UINT AFX_WM_ON_TABGROUPMOUSEMOVE = ::RegisterWindowMessage(_T("AFX_WM_ON_TABGROUPMOUSEMOVE"));
UINT AFX_WM_ON_CANCELTABMOVE = ::RegisterWindowMessage(_T("AFX_WM_ON_CANCELTABMOVE"));
UINT AFX_WM_ON_MOVETABCOMPLETE = ::RegisterWindowMessage(_T("AFX_WM_ON_MOVETABCOMPLETE"));
CMap CMFCTabCtrl::m_mapDocIcons;

afxdockablepane
CSize CDockablePane::m_sizeDragSensitivity = CSize(GetSystemMetrics(SM_CXDRAG), GetSystemMetrics(SM_CYDRAG));
IMPLEMENT_SERIAL(CDockablePane, CPane, VERSIONABLE_SCHEMA | 2)
UINT AFX_WM_ON_PRESS_CLOSE_BUTTON = ::RegisterWindowMessage(_T("AFX_WM_ON_PRESS_CLOSE_BUTTON"));

afxkeyboardmanager.h (again)

afxtoolbarmenubutton
IMPLEMENT_SERIAL(CMFCToolBarMenuButton, CMFCToolBarButton, VERSIONABLE_SCHEMA | 1)
static const CString strDummyAmpSeq = _T("0101");

afxwindowsmanagerdialog
UINT AFX_WM_WINDOW_HELP = ::RegisterWindowMessage(_T("WINDOW_HELP"));

afxkeyboardmanager.h (again)

afxtoolbarbutton.cpp
IMPLEMENT_SERIAL(CMFCToolBarButton, CObject, VERSIONABLE_SCHEMA | 1)
CString CMFCToolBarButton::m_strClipboardFormatName;
static const CString strDummyAmpSeq = _T("0101");

CList CMFCToolBarButton::m_lstProtectedCommands;

list_o

IMPLEMENT_SERIAL(CObList, CObject, 0)

afxpane
static const CString strControlBarProfile = _T("Panes");

afxdropdowntoolbar

IMPLEMENT_SERIAL(CMFCDropDownToolBar, CMFCToolBar, 1)
CString CMFCDropDownFrame::m_strClassName;
IMPLEMENT_SERIAL(CMFCDropDownFrame, CMiniFrameWnd, VERSIONABLE_SCHEMA | 1)
IMPLEMENT_SERIAL(CMFCDropDownToolbarButton, CMFCToolBarButton, VERSIONABLE_SCHEMA | 1)

afxtoolbarsystemmenubutton

IMPLEMENT_SERIAL(CMFCToolBarSystemMenuButton, CMFCToolBarMenuButton, VERSIONABLE_SCHEMA | 1)

afxbasetabctrl
UINT AFX_WM_ON_RENAME_TAB = ::RegisterWindowMessage(_T("AFX_WM_ON_RENAME_TAB"));
UINT AFX_WM_CHANGE_ACTIVE_TAB = ::RegisterWindowMessage(_T("AFX_WM_ONCHANGE_ACTIVE_TAB"));
UINT AFX_WM_ON_MOVE_TAB = ::RegisterWindowMessage(_T("AFX_WM_ON_MOVE_TAB"));
UINT AFX_WM_CHANGING_ACTIVE_TAB = ::RegisterWindowMessage(_T("AFX_WM_ON_CHANGING_ACTIVE_TAB"));
UINT AFX_WM_ON_GET_TAB_TOOLTIP = ::RegisterWindowMessage(_T("AFX_WM_ON_GET_TAB_TOOLTIP"));

afxkeyboardmanager.h (again)

afxcustomizebutton

IMPLEMENT_SERIAL(CMFCCustomizeButton, CMFCToolBarMenuButton, VERSIONABLE_SCHEMA | 1)

afxusertool

IMPLEMENT_SERIAL(CUserTool, CObject, VERSIONABLE_SCHEMA | 1)

afxkeyboardmanager.h (again)

afxpopupmenubar

IMPLEMENT_SERIAL(CMFCPopupMenuBar, CMFCToolBar, 1)

afxtaskspaneframewnd

IMPLEMENT_SERIAL(CMFCTasksPaneFrameWnd,CPaneFrameWnd,VERSIONABLE_SCHEMA | 2)

afxribbonpalettgallery

CMap CMFCRibbonGallery::m_mapSelectedItems;

afxkeyboardmanager.h (again)
afxkeyboardmanager.h (again)

afxoutlookbarpanebutton

IMPLEMENT_SERIAL(CMFCOutlookBarPaneButton, CMFCToolBarButton, 1)

afxoutlookbarpane

CMFCToolBarImages CMFCOutlookBarPane::m_Images;
IMPLEMENT_SERIAL(CMFCOutlookBarPane, CMFCToolBar, 1)

afxtabbedpane
CArray CTabbedPane::m_arTabsAutoColors;
CList CTabbedPane::m_lstTabbedControlBars;
IMPLEMENT_SERIAL(CTabbedPane, CBaseTabbedPane, VERSIONABLE_SCHEMA | 2)

afxmultipaneframewnd
IMPLEMENT_SERIAL(CMultiPaneFrameWnd,CPaneFrameWnd,VERSIONABLE_SCHEMA | 2)

afxpanecontainer
CPaneContainerGC gc;

afxoutlookbar
static const CString strOutlookBarProfile = _T("MFCOutlookBars");
static const CString strRegCustomPages = _T("MFCOutlookCustomPages");
IMPLEMENT_SERIAL(CMFCOutlookBar, CBaseTabbedPane, 1)

afxkeyboardmanager.h (again)

afxcustomizemenubutton
CMap CMFCCustomizeMenuButton::m_mapPresentIDs;

afxcolormenubutton
CMap CMFCColorMenuButton::m_ColorsByID;
UINT AFX_WM_GETDOCUMENTCOLORS = ::RegisterWindowMessage(_T("TOOLBAR__GETDOCUMENTCOLORS"));
IMPLEMENT_SERIAL(CMFCColorMenuButton, CMFCToolBarMenuButton, VERSIONABLE_SCHEMA | 1)

afxmousemanager

static const CString strRegEntryName = _T("Mouse");
static const CString strMouseProfile = _T("MouseManager");

IMPLEMENT_SERIAL(CMouseManager, CObject, 1)

docstat
IMPLEMENT_SERIAL(CDockState, CObject, 0)

afxrebarstate
static const CString strRebarKeyFmt = _T("Rebar-%ld");
static const CString strRebarKey = _T("RBI");
static const CString strRebarId = _T("IDs");

afxdockablepaneadapter

static const CString strControlBarProfile = _T("Panes");

IMPLEMENT_SERIAL(CDockablePaneAdapter, CDockablePane, VERSIONABLE_SCHEMA | 2)

afxribbonkeytip

CString CMFCRibbonKeyTip::m_strClassName;

winctrl4

AFX_DATADEF PROCESS_LOCAL(_AFX_RICHEDIT_STATE, _afxRichEditState)

afxribbonstatusbarpane
CMap CMFCRibbonStatusBarPane::m_mapAnimations;
CCriticalSection CMFCRibbonStatusBarPane::m_CriticalSection;

afxkeyboardmanager.h (again)

afxtoolbareditboxbutton
IMPLEMENT_SERIAL(CMFCToolBarEditBoxButton, CMFCToolBarButton, 1)

afxtaskpane
static const CString strTasksPaneProfile = _T("MFCTasksPanes");
IMPLEMENT_SERIAL(CTasksPaneNavigateButton, CMFCToolBarButton, 1)
IMPLEMENT_SERIAL(CTasksPaneHistoryButton, CMFCToolBarMenuButton, 1)
IMPLEMENT_SERIAL(CTasksPaneMenuButton, CMFCToolBarMenuButton, 1)

IMPLEMENT_SERIAL(CMFCTasksPaneToolBar, CMFCToolBar, 1)
IMPLEMENT_SERIAL(CMFCTasksPane, CDockablePane, VERSIONABLE_SCHEMA | 1)

afxoutlookbarpaneadapter
IMPLEMENT_SERIAL(CMFCOutlookBarPaneAdapter, CDockablePaneAdapter, VERSIONABLE_SCHEMA | 2)

ccdata

PROCESS_LOCAL(_AFX_PROPPAGEFONTINFO, _afxPropPageFontInfo)

viewedit
UINT _afxMsgFindReplace = ::RegisterWindowMessage(FINDMSGSTRING);

afxkeyboardmanager.h (again)

oleinit
OLE_DATA _oleData;

As you can see, it’s an incredibly long list. This is in the release build.