Adding an MFC Message Handler


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at Adding an MFC Message Handler.

You can use the Properties window to add a message handler (a member function that handles Windows messages) to a class and map Windows messages to the message handler. You can also add an event handler for any dialog box control.

By using the Properties window to define message- and event-handling functions, you can automatically update the message-dispatch table (or message map) and your class header file.

System_CAPS_ICON_note.jpg Note

You can add a message handler to an ATL class using the Properties window; however, some results may vary. For more information, see the ATL topic Adding an ATL Message Handler.

Adding Functionality with Code Wizards
Adding a Class
Adding a Member Function
Adding a Member Variable
Overriding a Virtual Function
Navigating the Class Structure
Dialog Editor