Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,
I am trying to learn win32 api programming.
I tried to create a menu to a win32 window and below are the contents of resource.h file generated by visual studio.

Problem: I am confused the way the menu identifiers are generated. I need to handle them in WM_COMMAND in WndProc procedure. But are these identifiers correctly generated.

Ex:
C++
#define ID_FILE_NEW40001                40001
#define ID_FILE_OPEN40002               40002


Instead of ID_FILE_NEW the identifier is generated as ID_FILE_NEW40001.

so this has to be handled in WM_COMMAND as follows

C++
case WM_COMMAND:
   switch(LOWORD(wParam)) {
      case ID_FILE_NEW40001 // instead of ID_FILE_NEW:
         // do something //
   }


please help.

Compiler: Visual studio 2010 ( vc++ )
Posted
Updated 25-May-12 9:50am
v2

1 solution

Provided the IDs are consistent between the source file and the resource file you can call them whatever you like.

You might find that the The reason the IDE has generated some weird looking IDs is that MFC defines ID_FILE_NEW and ID_FILE_OPEN and it wanted to make sure that there wasn't going to be a name collision.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900