   menu
  Hey all,I wrote the following thing in WM_COMMAND: case WM_COMMAND:  {    switch(LOWORD(wparam)){// handle the FILE menu    case MENU_FILE_ID_OPEN:{    // do work here} break;    case MENU_FILE_ID_CLOSE: {    // do work here } break;   case MENU_FILE_ID_SAVE: {   // do work here } break;   case MENU_FILE_ID_EXIT:  {   // do work here  } break; // handle the HELP menu  case MENU_HELP_ABOUT: {  // do work here } break;  default: break;} // end switch wparam  } break; // end WM_COMMANDIn the resource.h i wrote:#define MENU_FILE_ID_OPEN 1000#define MENU_FILE_ID_CLOSE 1001#define MENU_FILE_ID_SAVE 1002#define MENU_FILE_ID_EXIT 1003and in the .rc i wrote:MainMenu MENU DISCARDABLE {   POPUP "File"   {    MENUITEM "Open", MENU_FILE_ID_OPEN    MENUITEM "Close",MENU_FILE_ID_CLOSE    MENUITEM "Save", MENU_FILE_ID_SAVE    MENUITEM "Exit", MENU_FILE_ID_EXIT   } // end popup   POPUP "Help"   {    MENUITEM "About", MENU_HELP_ABOUT   } // end popup} // end top level menuWhen i compile it writes:error C2065: ''MENU_FILE_ID_OPEN'' : undeclared identifierC:\Program Files\Microsoft Visual Studio\VC98\mainmenu\main.cpp(35) : error C2051: case expression not constantC:\Program Files\Microsoft Visual Studio\VC98\mainmenu\main.cpp(39) : error C2065: ''MENU_FILE_ID_CLOSE'' : undeclared identifierC:\Program Files\Microsoft Visual Studio\VC98\mainmenu\main.cpp(39) : error C2051: case expression not constantC:\Program Files\Microsoft Visual Studio\VC98\mainmenu\main.cpp(43) : error C2065: ''MENU_FILE_ID_SAVE'' : undeclared identifierC:\Program Files\Microsoft Visual Studio\VC98\mainmenu\main.cpp(43) : error C2051: case expression not constantC:\Program Files\Microsoft Visual Studio\VC98\mainmenu\main.cpp(47) : error C2065: ''MENU_FILE_ID_EXIT'' : undeclared identifierC:\Program Files\Microsoft Visual Studio\VC98\mainmenu\main.cpp(47) : error C2051: case expression not constantC:\Program Files\Microsoft Visual Studio\VC98\mainmenu\main.cpp(52) : error C2065: ''MENU_HELP_ABOUT'' : undeclared identifierC:\Program Files\Microsoft Visual Studio\VC98\mainmenu\main.cpp(52) : error C2051: case expression not constantC:\Program Files\Microsoft Visual Studio\VC98\mainmenu\main.cpp(57) : warning C4065: switch statement contains ''default'' but no ''case'' labelsHow can i fix it?thanks in advance 
  Are you linking them together correctly?Did you include your menu resource ID?"#define IDR_MYMENU 101"This may be just me, probably is me, but in your WM_COMMAND, under your "default" don''t you need to include "return DefWindowProc(hwnd, Message, wParam, lParam);" instead of breaking out of it? ;  Simple.   You just need to include the resource.h file, in your .rc file, like so:#include "resource.h"   Try that. Edit:  You need to include the resource.h file in your main.cpp file, too.--hellz   [edited by - hellz on August 4, 2003 11:43:57 AM];  Yep it did it!i included the resource file in the .rc but not in the .cpp.Thanks hellz and Xiachunyi.;  No problem. --hellz 