Mapping Windows Messages to Your Class
If you need your dialog box to handle Windows messages, override the appropriate handler functions. To do so, choose the Class View tab in Solution Explorer, right click on the class that represents the dialog box, and choose Class Wizard. Use the wizard to map the messages to the dialog class. This writes a message-map entry for each message and adds the message-handler member functions to the class. Use the code editor to write code in the message handlers.
You can also override member functions of CDialog and its base classes, especially CWnd.