Message Mapping Mechanisms in MFC and Other Applications in Visual C - PowerPoint PPT Presentation

About This Presentation
Title:

Message Mapping Mechanisms in MFC and Other Applications in Visual C

Description:

When using a Windows program, there are many types of messages (events) generated. ... MFC ActiveX Control Wizard: Allow you to write ActiveX control which can be ... – PowerPoint PPT presentation

Number of Views:144
Avg rating:3.0/5.0
Slides: 8
Provided by: chi115
Category:

less

Transcript and Presenter's Notes

Title: Message Mapping Mechanisms in MFC and Other Applications in Visual C


1
Message Mapping Mechanisms in MFC and Other
Applications in Visual C
  • Speaker Yao-Ting Huang
  • Advisor Kun-Mao Chao

National Taiwan University Department of Computer
Science Information Engineering Algorithms and
Computational Biology Lab.
2
Message Mapping in Writing MFC
  • When using a Windows program, there are many
    types of messages (events) generated.
  • e.g., mouse clicked, key pressed, or window
    closed.
  • When writing a Windows program, it is essential
    to assign the handling function to each
    corresponding message.
  • The message processing is a switch-like
    statement.
  • switch(message) case WM_MOUSEMOVE //handle
    mouse movement here. break case
    WM_CLOSE //handle window close here. break

3
Message Mapping in Writing MFC
  • MFC avoids the detail message processing by
    providing Message Map.
  • There are default handling functions assigned to
    common messages.
  • You can add your own handling function to
    specific message.
  • e.g., BEGIN_MESSAGE_MAP(CTest2App,
    CWinApp) ON_COMMAND(ID_APP_ABOUT,
    OnAppAbout) ON_COMMAND(ID_FILE_NEW,
    CWinAppOnFileNew) ON_COMMAND(ID_FILE_OPEN,
    CWinAppOnFileOpen) ON_COMMAND(ID_FILE_PRINT_SET
    UP, CWinAppOnFilePrintSetup)END_MESSAGE_MAP()

4
Message Mapping in Writing MFC
  • When you choose to open a file, the
    CWinAppOnFileOpen function will be invoked,
    which will popup a file dialog to the user.
  • You can use the class wizard in Visual C to
    manage the message map.
  • See an example in Visual C.

5
Building Other Applications by Visual C
  • You can create other types of applications by
    selecting different projects in Visual C.
  • Database project Allow you to write SQL to
    manage a database.
  • Internet Server API (ISAPI) Extension Wizard
    Allow you to write Windows socket, email, and
    other Internet applications.
  • MFC ActiveX Control Wizard Allow you to write
    ActiveX control which can be embedded into
    dialog, VB program, or WWW pages, to offer
    additional functionalities.

6
Remind of Homework 3
  • Write a program that prompts the user to input
    the boiling point in degree Celsius.
  • The program should output the substance
    corresponding to the boiling point listed in the
    table.
  • The program should output the message substance
    unknown when it does not match any substance.
  • For the details, please refer to the slide of
    last week.
  • The due date is 11/4.

7
Outline of Lecture Today
  • Manipulate the message map in a MFC application.
  • Demo of your Homework 2.
  • Please make sure your program is ready to execute.
Write a Comment
User Comments (0)
About PowerShow.com