Deleting a Message Handler

OverviewHow Do I

Once you have defined a message handler, you can use ClassView, WizardBar, or ClassWizard to delete it. If you use ClassWizard, you must manually remove the function definition, as well as any references to the function, from the implementation file. ClassWizard deletes the declaration, but does not make changes to your implementation code — only to the message and data maps.

Note   ClassWizard is unable to delete message handlers for ATL objects. Use ClassView or the WizardBar instead.

With ClassView and WizardBar, deleting a message-handling function is the same as deleting any other member function. ClassView and WizardBar delete the function declaration, removes any associated map entry from the MSG, MESSAGE or DISPATCH map, and comment out the function body, or definition, so that you can easily delete it if you wish.

Caution   There is no UNDO facility for the deleted function declaration.

What do you want to do?

Use ClassWizard to delete a message handling function

Use WizardBar or ClassView to delete a member function

To use ClassWizard to delete a message-handling function

  1. In the ClassWizard dialog box, click the Message Maps tab.

  2. In the Class name box, select the class containing the message-handling function you want to delete.

  3. In the Member functions box, select the name of the member function to delete.

  4. Click Delete Function. This deletes the function entries from the message map for that class in both the header and implementation files.

  5. You will be reminded to edit the implementation file containing the member function. Using a text editor, comment out or delete the function header and function body.