|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Adding an Event Handler
From the resource editor, you can add a new event handler, or edit an existing event handler, for a dialog box control using the Event Handler Wizard.
You can add an event to the class implementing the dialog box using the Properties window. If you want to add the event to a class other than the dialog box class, use the Event Handler Wizard.
To add an event handler to a dialog box control
Right-click the control for which you want to handle the notification event.
On the shortcut menu, click Add Event Handler to display the Event Handler Wizard.
Select the event in the Message type box to add to the class selected in the Class list box.
Accept the default name in the Function handler name box, or provide the name of your choice.
Click Add and edit to add the event handler to the project and open the text editor at the new function to add the appropriate event handler code.
If the selected message type already has an event handler for the selected class, Add and edit is unavailable, and Edit code is available. Click Edit code to open the text editor at the existing function.