Guide for making a simple project in Visual C++ with MFC support
Created: 28-April-2003
Last Updated: 17-July-2003
by: Yasir N. Khan
Making a new Project through Wizard:
Make sure there is no project open. (Fileà
Close Workspace)
- Select
FileàNew
- In the
Menu, select “MFC AppWizard(exe)”.
- Choose
a “project name” and “Location”.
- Select
“OK”.
- Select
“Single Document”. Uncheck (deselect) “Document/View architecture
support?”.
- Press
“Finish”. (You can select “Next” to explore other options, but you don’t
need to change them). Then press “OK” in confirmation box.
In the “Workspace Pane”, you can see the classes that are
generated by the wizard:

Inserting your own classes:
To insert your own class in the project,
- Select
InsertàNew
Class
- Select
“Class Type” to be “Generic Class”
- Enter
Class name. By convention, class names have an extra C before their name.
e.g. a class “Game” will be named as “CGame”. Your new class will be displayed
in the
- To add
attributes to the class, right-click on your class and select “Add Member
Variable”.
- To add
functions to the class, right-click on your class and select “Add Member
Function”

Display a message in a Dialog Box:
The simplest way to display a message to the user is to call
the function “AfxMessageBox(…)”. Pass a text string in the arguments that
should be displayed.
Inserting Windows Message Handlers
Windows Message Handlers are functions that are called when
user performs some action on your application. To add a Windows Message
Handler: