Presentation is loading. Please wait.

Presentation is loading. Please wait.

MFC Dialog Application

Similar presentations


Presentation on theme: "MFC Dialog Application"— Presentation transcript:

1 MFC Dialog Application
Steps to Build MFC Dialog in VS.Net 2003 Instructor : Dr.James Fawcett Prepared by : Priyaa Nachimuthu Summer 2004

2 Text Generator in action

3 Intent Accept text entered into the top EditBox.
Transfer text to the second EditBox as it is typed – illustrates use of text controls. When user hits Add button the contents of the top edit box will be transferred to a list box. Note: You must #include “stdafx.h” at the top of every *.cpp file in your server implementation.

4 Construction Steps - Summary
Run Application Wizard Select MFC Application project Select Dialog-based Pull controls from control palette onto dialog in Resource View. Add message handlers for every event you want to handle. You can either right-click on dialog class in Class View to add handler Or you double click on the control you want to handle, e.g., EditBox or Button. When you double click, you get a handler for the most common message for that control. That may or may not be what you want. You get more control by using the first method. The second method is faster. Add code in message handlers, perhaps by calling a server module providing the computational engine for your interface. Compile, Edit, and Run repeatedly until you get the behavior and appearance you want.

5 Resulting Dialog Structure

6 Construction Steps – Creating a MFC Project
Create a blank solution and add a new project Select Visual C++ Projects - MFC Application

7 Construction Steps – Application wizard
You will be directed to MFC Application wizard

8 Construction Steps – Application Type
Select Dialog –based application

9 Construction Steps – UI Features
Choose the desired user interface features

10 Construction Steps – Advanced Features
Uncheck ActiveX controls if none is used in the application

11 Construction Steps – Resource view
On finish,App wizard directs to a resource editor

12 Construction Steps – Populating a dialog
Use tool box to populate dialog

13 Construction Steps – Adding a variable
Right click on the control (Edit Box) to add a variable

14 Construction Steps – Add variable wizard
Select the variable type,type in the variable name, and choose category as value for Edit Box control

15 Construction Steps – Adding a variable
Right click on the control (List Box) to add a variable

16 Construction Steps – Add variable wizard
Select the variable type,type in the variable name, and choose category as control for List Box control

17 Construction Steps – Adding an event handler for a button control
Double click on the control or choose an event handler from the control’s properties window

18 Construction Steps – Adding an event handler for an Edit Box
Double click on the control or choose an event handler from the control’s properties window

19 Construction Steps – Adding a Windows Message Handler
In the main dialog’s properties window,select the right most Messages icon which lists all windows message handlers

20 Construction Steps – Adding a Windows Message Handler
Choose a message handler ( WM_LBUTTONDOWN – OnLButtonDown handler )

21 Construction Steps – Adding code for event handlers
Add code for event handlers in MFCDialogDemoDlg.cpp

22 Construction Steps – Adding code for OnOK event handler
Add code for event handlers in MFCDialogDemoDlg.cpp

23 Add Code, Compile, and Run


Download ppt "MFC Dialog Application"

Similar presentations


Ads by Google