Handling Windows Messages in Your Dialog Box
Dialog boxes are windows, so they can handle Windows messages if you supply the appropriate handler functions. When you create your dialog class with the Add Class Wizard, the wizard adds an empty message map to the class. Use the Properties window to map any Windows messages or commands you want your class to handle.
See Mapping Windows Messages to Your Dialog Class for more information.