Discussion:
Two resource files having same identifier value
(too old to reply)
SM
2010-04-20 06:24:53 UTC
Permalink
Hi,
I created an ATL project , a resource file was created by default.
When I opened the Resource.h file, i have a value as below
#define IDR_TESTATLRESOURCE 101
Now i added a new resource file using add new item option, adding a
Menu as below
Options
Options1
Options2
When I opened the resource1.h file, i have a value as below
#define IDR_OPTIONSMENU 101
Two Identifiers have same values as 101(auto generated by vc++).
Is this ok to have same values for Identifiers or do I need to change
values manually?

Thanks,
Sony
David Lowndes
2010-04-20 08:46:16 UTC
Permalink
Post by SM
When I opened the resource1.h file, i have a value as below
#define IDR_OPTIONSMENU 101
Two Identifiers have same values as 101(auto generated by vc++).
Is this ok to have same values for Identifiers or do I need to change
values manually?
If the identifiers are for the same type of resource, then obviously
there's a problem. If they're for different things (such as a menu
item and a string) there shouldn't be a problem.

Dave
John H.
2010-04-21 18:50:43 UTC
Permalink
Post by David Lowndes
Post by SM
When I opened the resource1.h file, i have a value as below
#define IDR_OPTIONSMENU                 101
Two Identifiers have same values as 101(auto generated by vc++).
Is this ok to have same values for Identifiers or do I need to change
values manually?
If the identifiers are for the same type of resource, then obviously
there's a problem. If they're for different things (such as a menu
item and a string) there shouldn't be a problem.
In addition to what Mr. Lowndes said:
Controls in different dialogs can have the same identifier value.
For instance, say I have two dialogs:
#define IDD_MOVIE 101
#define IDD_ICECREAM 102
Each dialog has a control that show a picture:
#define IDC_MOVIE_PICTURE 1001 // used in the movie dialog
#define IDC_ICECREAM_PICTURE 1001 // used in the ice cream dialog
This should work ok.
You could even just have one #define that is used in both dialogs:
#define IDC_PICTURE 1001
but this might not be a good practice from a software engineering
perspective.

Loading...