Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 15: Fundamental Controls


the event would be supplied to you. If you decide to write the event from scratch, you
will need to especially remember the arguments of the event, otherwise the code may not
work at all.

Practical Learning: Generating Events



  1. From the Resource View tab, display the IDD_QUADRILATERAL dialog box
    On the dialog, right-click the edit box on the right side of Side and click Add Event
    Handler...

  2. See the types of messages for the edit box. Click Cancel

  3. Right-click the top Calculate control and click Add Event Handler...

  4. Read and accept everything that is set on the wizard

  5. Click Add And Edit

  6. In the same way, generate an event for all Calculate controls of the
    IDD_QUADRILATERAL, the IDD_CIRCULAR, and the IDD_G3D dialog boxes

  7. Save All


14.2 Controls Management.................................................................................


14.2.1..Control’s Identification......................................................................


So far, we have seen various techniques of visually adding or dynamically creating
controls for your application. We also saw that every control should have identification.
In fact, if you want to avoid providing an identification for a control, you may have to use
the Win32 API’s CreateWindow() or CreateWindowEx() function to create the control.
We saw that the identifier can be created either using the Properties window, using the
Resources Symbols dialog box, using the String Table, or when dynamically creating the
control. We also saw how to declare or add a control variable for an MFC control.
Free download pdf