The DIALOGS.H File

If you define symbolic names in your dialogs, the Dialog Editor writes them to a .H file.

When you create a dialog control, it gets an ID number. You can also assign a symbolic name to the control, and can refer to the control by name or number in your code. The .H file associates symbolic names with corresponding ID numbers.

A typical .H file looks like this:

#define MYOPTION1  101
#define MYOPTION2  102
 

You can then refer to controls in this way:

LRESULT CALLBACK FirstDlgProc(HWND hDlg, UINT wMessage, WPARAM wParam, LPARAM lParam)
{
 .
 .
 .
case WM_COMMAND: 
   switch (LOWORD(wParam))
   {
      case IDOK :
         // Respond to Ok button here 
         break; 
      case IDCANCEL :
         // Respond to Cancel button here 
         break;
      case MYOPTION1:
         // Respond to MyOption1 button here 
         break;
      case MYOPTION2:
         // Respond to MyOption2 button here 
         break;
 .
 .
 .
   } 
}

Remember that IDOK and IDCANCEL are defined by the system and should be used for the OK and Cancel buttons in your dialog box.