MFC Samples
The following table is an alphabetical list of the MFC samples included with Visual C++.
In This Section
Advanced Samples
COLLECT Sample: Illustrates MFC Collection Classes
Demonstrates MFC C++ template-based collection classes and standard prebuilt collection classes.CUBE Sample: Demonstrates an OpenGL Application
OpenGL application using MFC device contexts along with OpenGL's resource contexts.DlgToolTips Sample: MFC Dialog Tooltips Application
Demonstrates how to implement advanced tooltips for controls on a dialog box.DLLHUSK Sample: Dynamically Links the MFC Library
Sharing the DLL version of the Foundation class library with an application and custom DLL.DLLScreenCap Sample: Demonstrates a Regular DLL That Statically or Dynamically Links to MFC
A regular DLL that can be statically or dynamically linked to the Microsoft Foundation Class Library.DynamicMenu Sample: MFC Dynamically Updated Menu Application
Demonstrates how to dynamically update a menu on the menu bar and a popup menu at run-time.MenuSubSet Sample: MFC Menu Subset Application
Demonstrates how to dynamically remove specific menu items and submenus at application startup.MTMDI Sample: Demonstrates an MFC User Interface Thread
Multithread illustration, where user-interface events are processed in a separate user-interface thread.MTRECALC Sample: Supports Multithread Applications
Multithread illustration, where recalculations are performed in a worker thread.NewControls Sample: MFC Controls Demonstration Application
Demonstrates the capabilities of many of the controls implemented in MFC, including customizable buttons, color picker controls and palettes, a font chooser, an image editor, a property grid, a masked edit control, and shell list and tree controls.OwnerDrawMenu Sample: OwnerDraw Menu Application
Illustrates how to draw popup menu items dynamically.RebarTest Sample: Rebar Testing Application
Demonstrates a customizable Rebar control which hosts a toolbar.SPEAKN Sample: Demonstrates Multimedia Sound Using User-Defined Resources
Demonstrates Multimedia Sound Using User-Defined Resources.StateCollection Sample: MFC Toolbar Collection Application
Demonstrates how to implement an application that saves and loads different states for the menu bar, toolbars, and docking windows.StatusBarDemo Sample: MFC Status Bar Application
Demonstrates how to add various advanced controls to a status bar.ToolTipDemo Sample: Demonstrates Advanced MFC ToolTip Features
Demonstrates how to use advanced MFC tooltip features. It demonstrates the following four types of tooltips: standard, custom tooltip with parameters, extended and CMFCToolTipCtrl-derived tooltip object.
Controls Samples
BUTTON Sample: Demonstrates a Menu and a Property Page
Demonstrates use of an in-place active menu, a stock property page, and the About box control option.CIRC Sample: ActiveX Control
Demonstrates ActiveX control basics, including control painting, stock and custom properties, stock and custom events, use of colors and fonts, the stock Font property page, the default property page, and versioning.CONTAINER Sample: Visual Editing Container Application
Demonstrates a Visual Editing Container Application.IMAGE Sample: Creates an ActiveX Control That Downloads Asynchronously
Demonstrates how to use MFC to build an ActiveX control that is capable of downloading data asynchronously.LICENSED Sample: Enforces Use of Design-Time and Run-Time Licenses
A control that enforces use of a design-time and run-time license.LOCALIZE Sample: Control with a Localized User Interface
A control with a localized user interface that demonstrates use of separate type libraries and resource dynamic-link libraries (DLLs) for localization.NETADDR Sample: Vista Net Address Verifier Control Sample
Demonstrates use of the Windows Vista "Net Address Verifier" control.REGSVR Sample: Invokes Self-Registration Code
Demonstrates the invocation of Self-Registration Code.SPINDIAL Sample: Demonstrates Property Page Validation
A control with the visual appearance of a spin-dial that demonstrates property page data validation.TESTHELP Sample: ActiveX Control with Tooltips and Help
An ActiveX control that has its own help file and tooltips.TIME Sample: Fires a Timer at Set Intervals
A control that is invisible at run time and fires a timer event at set intervals. Demonstrates notification functions and ambient properties.XLIST Sample: Displays Text or Bitmaps
A control, subclassed from a Windows list box, that displays text or bitmap items.
General Samples
Sample CLIPART: Common Resources
The CLIPART directory contains sample resources that you can use to customize the appearance of your application.CFileDialog Sample: Logging Event Order
Creates a custom dialog box that illustrates what events are generated when you create a CFileDialog.CMNCTRL1 Sample: Demonstrates Common Control MFC Classes, Part 1
Demonstrates how to create and change the styles of Windows Common Controls using MFC classes (Part 1).CMNCTRL2 Sample: Demonstrates Common Control MFC Classes, Part 2
Demonstrates how to create and change the styles of Windows Common Controls using MFC classes (Part 2).CMNCTRL3 Sample: Demonstrates New MFC Controls Available in Visual Studio 2008
Demonstrates some of the new controls available with MFC on Windows Vista, including the command link button (CButton), the pager control (CPagerCtrl), the split button (CSplitButton), and the network address control (CNetAddressCtrl).CTRLBARS Sample: Illustrates Custom Control Bars
Custom toolbar and status bar, dialog bar, and floating palette.CTRLTEST Sample: Implements Custom Controls
Owner-draw list box and menu, custom control, bitmap button, spin control.CustomPages Sample: MFC Toolbar Customization Dialog Application
Demonstrates how to add a custom page to the Toolbar Customization dialog box. The Toolbar Customization dialog box is opened by clicking the small dropdown at the end of the menu, and selecting the Customize menu item.DesktopAlertDemo Sample: MFC Desktop Alert Application
Demonstrates how to implement a desktop alert dialog box (similar to the dialog box that an instant messaging application displays).DIBLOOK Sample: Illustrates the Use of DIBs and Color Palettes
Demonstrates the Use of DIBs and Color Palettes.DLGCBR32 Sample: Demonstrates Adding a Status Bar and Toolbar to Dialog Boxes
Adding a toolbar and a status bar to a dialog-based application.DLGTEMPL Sample: Creates Dialog Templates Dynamically
Demonstrates the dynamic creation of dialog templates.DOCKTOOL Sample: Demonstrates Dockable Toolbars
Dragging and floating toolbars that are "dockable".DYNAMENU Sample: Dynamically Updates Menus
Dynamically modifying list of items in menus; handling commands not known at compile time; and updating the status bar command prompt for such commands.GUIDGEN Sample: Generates Globally Unique Identifiers (GUIDs)
A simple dialog-based MFC application that can help you as you code ActiveX applications.MAKEHM Sample: Utility for Associating Resources with Help Contexts
A console application that produces a mapping between resource identifications and Help contexts.MDI Sample: Demonstrates MDI Without Using Doc/View Architecture
MDI application that does not use documents and views.MDIDOCVW Sample: Demonstrates MDI Using Doc/View Architecture
New version of the MDI sample that uses the document/view architecture.MDITabsDemo Sample: MFC Tabbed MDI Application
Demonstrates how to create an application that uses the new tabbed MDI documents interface instead of the traditional MDI child windows.MMXSwarm Sample: Demonstrates CImage and Visual C++ MMX Support
Demonstrates how to use CImage, the __m64 data type, and device-independent bitmaps (DIBs).MODELESS Sample: Uses a CDialog Object as a Modeless Dialog Box
Demonstrates the use of an MFC CDialog object as a modeless dialog box.NPP Sample: Demonstrates the Windows Messaging API (MAPI)
Demonstrates the Windows Messaging API (MAPI).OutlookMultiViews Sample: An SDI Application with Multiple Views and Outlook Bar control
Demonstrates how to switch between multiple views on a single document in an SDI application. The sample uses the Outlook bar control to list the available views and switch between them.PaletteDemo Sample: Custom Multi Column Toolbar (Palette) Application
Illustrates how to create a multi-column toolbar with an owner-draw information area. Click 2, 3 or 4 buttons on the Standard toolbar in order to change at the runtime the number of columns of the custom toolbar.PROPDLG Sample: Demonstrates Property Sheet Support
Property sheets (dialogs).PropSheetDemo Sample: Property Sheet Demonstration Application
Illustrates the following types of Property Sheet control: simple, with tabs at the left side, with tree control at the left side, OneNote-style tabs, list of items at the left side.RibbonGadgets Sample: Ribbon Gadgets Application
Illustrates various controls that can be hosted in the Ribbon Control. At the bottom of the main frame you can find the Source Code window with source code text, which outlines how to create a particular gadget.RibbonMDIDemo Sample: MDI with Ribbon Control Demonstration Application
Demonstrates usage of Ribbon Control with Multi Document Interface.
Internet Samples
DHtmlExplore Sample: Demonstrates Using MFC DHtml Classes
Demonstrates handling DHTML events and using DHTML DDX.HTMLEdit Sample: Wraps the Internet Explorer MSHTML Editing Control
Wraps the Internet Explorer MSHTML editing control.MFCIE Sample: Demonstrates the MFC CHtmlView and CReBar Classes
Demonstrates the MFC CHtmlView and CReBar Classes.StockTicker Sample: Displays Web Information in an ATL Control
An MFC and ATL application that retrieves stock quotes from the Web and displays them in an ATL control. The user can set the display's properties, including rate of data refresh.
MFC Windows Forms Samples
- WinFormIntegration Sample: Shows How to Host a Windows Forms User Control in an MFC Application
Demonstrates how to host a Windows Forms user control as a dialog box or a view in an MFC application.
OLE Samples
ACDUAL Sample: Adds Dual Interfaces to an Automation Application
Demonstrates how to add dual interface support to an MFC-based Automation server.AUTOCLIK Sample: Automation Server Application
Illustrates Automation features. Includes AUTODRIV, a simple Automation client application that drives the AUTOCLIK sample application.CALCDRIV Sample: Demonstrates an Automation Client Application
Automation client.DRAWCLI Sample: Illustrates Integrating Active Container Support with Application-Specific Features
Full-featured object-oriented drawing application that is also an ActiveX Visual Editing container.HIERSVR Sample: Demonstrates a Server Application with OLE Drag and Drop
Demonstrates a Server Application with OLE Drag and Drop.INPROC Sample: Demonstrates an In-Process Automation Server Application
An in-process Automation server that can be loaded as a DLL in the client's address space.IPDRIVE Sample: Demonstrates an Automation Client Application
A simple Automation client application that drives the INPROC sample application.MFCBIND Sample: Active Document Container
Shows how to create an Active document (formerly known as a DocObject) container.MFCCALC Sample: Demonstrates an Automation Server Application
An Automation server that implements a simple calculator.OCLIENT Sample: Illustrates a Visual Editing Container Application
ActiveX Visual Editing container application, with drag and drop.OLEVIEW Sample: ActiveX Object Viewer
Implementing an OLE object browser through custom OLE interfaces.SUPERPAD Sample: Demonstrates a Visual Editing Server That Edits Text Using CEditView
Demonstrates a Visual Editing Server That Edits Text Using CEditView.TSTCON Sample: ActiveX Control Test Container
Implements an ActiveX control container using MFC's support for OLE embedding. You can use TSTCON to test ActiveX controls, change their properties, and invoke their methods.WORDPAD Sample: The Windows Application
Uses MFC's support for rich edit controls to create a basic word processor.
Miscellaneous Applications Samples
Explorer Sample: MFC Windows Explorer Application
Demonstrates how to implement a file system explorer that resembles the Windows Explorer, with similar user interface elements and capabilities.IEDemo Sample: MFC Internet Explorer Application
Demonstrates how to implement an application similar to Internet Explorer, with similar user interface elements and capabilities.MSMoneyDemo Sample: Microsoft Money User Interface Sample
Demonstrates how to use MFC to create a user interface similar to Microsoft Money.MSOffice2007Demo Sample: MFC Office Application
Demonstrates how to implement an editor application similar to an Office 2007 application, with similar user interface elements and limited similar capabilities. The MSOffice2007Demo sample implements a very full ribbon user interface much like an Office 2007 application, and some (but not all) of the ribbon elements are connected to capabilities in the application.OutlookDemo Sample: MFC OutlookDemo Application
Demonstrates how to create an application similar to Microsoft Outlook 2003/2007. You can change the current Visual Theme using the Application Look dialog, which can be opened from the View | Application Look… menu. Note the Outlook Bar Office 2003 style check box. This option lets you switch between different modes of navigation pane (known also as outlook bar), which is docked at the left side of application window. Click the "New" toolbar button to open a mail frame. This window emulates a form used in Microsoft Outlook to compose e-mail messages.VisualStudioDemo Sample: MFC Visual Studio Application
Demonstrates how to implement an application with many of the same user interface features and some of the capabilities of Visual Studio. Many of the Visual Studio user interface elements, including customizable docking menubar and toolbars, and docking windows, are demonstrated.WordPad Sample: MFC WordPad Application
Demonstrates how to implement an application that imitates the functionality of WordPad, including the user interface elements and some of the capabilities.