-
September 20th, 2012, 01:51 PM
#1
Resources and enum
Hi, I got a problem with a resource file. In my *.rc file I've defined a menu:
Code:
#include "resources.h"
#include "afxres.h"
MAINMENU MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New", IDM_FILE_NEW
MENUITEM "E&xit", IDM_FILE_EXIT
END
/* POPUP "&Window"
MENUITEM "&Close All", IDM_WINDOW_CLALL
END
POPUP "&Help"
BEGIN
MENUITEM "&Help", IDM_HELP_HELP
MENUITEM "&About OurCANOE", IDM_HELP_ABOUT
END*/
END
and in my resource.h file I have the definitions of the IDM identifiers...
Code:
#define IDM_FILE_NEW 10000
#define IDM_FILE_EXIT 10001
//enum{IDM_FILE_NEW = 10000, IDM_FILE_EXIT};
//enum {IDM_WINDOW_CLALL = 20000};
//enum {IDM_HELP_HELP = 30000, IDM_HELP_ABOUT};
I wanted to use the enum type, to define these identifiers, so I the numbers are assigned automatically, but the compiler throws an error. Is it even possible to use the enum type instead of #define? If not, why? :-)
Thanks in advance.
Last edited by HellMaster22; September 20th, 2012 at 02:03 PM.
-
September 20th, 2012, 02:13 PM
#2
Re: Resources and enum
This is why: Resource compiler is not C++ compiler, it knows nothing about enums.
Best regards,
Igor
-
September 20th, 2012, 02:15 PM
#3
Re: Resources and enum
Ahhh, thanks. So there is no other choice then to use the preprocessor directive #define. Is there a way, how to use the enum? Because it would simplify the whole ID management... :-)
Last edited by HellMaster22; September 20th, 2012 at 02:23 PM.
-
September 20th, 2012, 03:35 PM
#4
Re: Resources and enum
No, there's no a way. RC needs integer ids. Period.
Best regards,
Igor
-
September 24th, 2012, 09:01 AM
#5
Re: Resources and enum
Completing a little bit beyond the Igor's "period" , the "resource IDs management" can be done by changing _APS_NEXT_RESOURCE_VALUE, _APS_NEXT_COMMAND_VALUE, _APS_NEXT_CONTROL_VALUE, and _APS_NEXT_SYMED_VALUE, which can be found at the bottom of the resource.h file.
You can find info about them here: http://msdn.microsoft.com/en-us/libr...(v=vs.80).aspx.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|