MFC Samples
The following table is an alphabetical list of the MFC samples included with Visual C++.
Note
When building a sample application, first verify that the platform is set to your current platform in the Solution's Configuration property page. For example, you may need to change the platform from Itanium to Win32.
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.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.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 done in a worker thread.SPEAKN Sample: Demonstrates Multimedia Sound Using User-Defined Resources
Demonstrates Multimedia Sound Using User-Defined Resources.
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.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.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.NPP Sample: Demonstrates the Windows Messaging API (MAPI)
Demonstrates the Windows Messaging API (MAPI).PROPDLG Sample: Demonstrates Property Sheet Support
Property sheets (dialogs).ROWLIST Sample: Demonstrates Selecting Full Rows in List Views
Illustrates full row selection in a list-view common control.SCRIBBLE Sample: MFC MDI Drawing Application
SCRIBBLE is drawing application that provides simple illustrations of a wide breadth of MFC features.SimpleImage Sample: Loads, Resizes, Converts, and Saves Images
Demonstrates loading, resizing, conversion, and saving images.SNAPVW Sample: Uses Property Pages in a Form View Application
Shows how to use property pages in a MDI child frame window.Spiro Sample: Animated Drawing Game
A game that shows to use CImageList and how to use memory display contexts in applications requiring animation effects.TRACKER Sample: Illustrates Various CRectTracker Styles and Options
Demonstrates various CRectTracker styles and options.VariantUse Sample: Demonstrates the Use of Variants
Demonstrates the use of the variant data type.VIEWEX Sample: Demonstrates Multiple Views, Scroll Views, and Splitter Windows
Multiple views, scroll view, splitter windows.
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: Demonstrates Hosting 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.