Windows Systems Programming: Spring 2002

[ Home | Syllabus | Course Notes | Assignments | Search]


Menus (chapter 4)

This discussion is based on the Shapes application from chapter 4.
It would be useful to build this program by following the directions in the book. This is get you familiar with visual c++.


Menus

There are three ways to create menus:

  1. Programmatically (pp. 226-228)
  2. Through data structures
    these first two allow dynamic creation of menus
  3. With Resource File
    this allows a visual editing tool to help create this (or you can use a text editor)

 


Resource Editor

If you examine the Menu in the resource view, you will notice the following


Add a new shape

To illustrate the relationship among the menu, menu message, and message handlers, let's add a new shape. For simplicity, let's draw a blue line. Here is the steps required.

NOTE: it is important that we route command messages to the CChildView from CFrameWnd since that is where we placed the message handlers. This is handled by the appwizard (click here to see)

Original source code for Shape application

Modified source code for Shape application

 


Copyright chris wild 1999-2002.
For problems or questions regarding this web contact [Dr. Wild].
Last updated: January 29, 2002.