Create Handlers for Add, Refresh, and Delete

Each of the new Record menu commands needs a command handler function in the CSectionForm class. Since the Enroll menu resource is associated with the CMainFrame class, you must make an association between the menu IDs and the CSectionForm class. You do this by giving focus to the IDR_MAINFRAME resource (accelerator or menu) so ClassWizard can glean the available command IDs from the resource.

Suggested Reading in the Visual C++ Programmer’s Guide

To create handlers for the commands

  1. With focus on the IDR_MAINFRAME resource, from the View menu, click ClassWizard and click the Message Maps tab.

    Notice that the CMainFrame class is automatically selected.

  2. In the Class Name box, select CSectionForm.

  3. In the Object IDs list, select the ID_RECORD_ADD command ID; in the Messages box, select COMMAND; and then click Add Function to create a command handler function.

    Accept the default handler name: OnRecordAdd.

  4. Repeat step 3 for the ID_RECORD_DELETE and ID_RECORD_REFRESH command IDs.

  5. Click OK to exit ClassWizard.

    You can also close the resource editors at this point.

You will fill in the command handlers in later topics.