Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MFC Resource ID uniqueness

Tags:

mfc

This is basically an extension of the question here.

I am working on an old MFC application where it seems the resource.h file has been manually edited and has gone messy. I see that there are conflicting IDs in there.

I just want to confirm if we can have two resources with the same ID of different type. For example, I have something like

IDD_1     101
IDS_2     101

or

IDR_1     102
IDS_2     102

Basically, there are resources defined with the same ID, but of different types.

A comment to the original question says that Resources of the same type don't share identifiers. If that is true, is it also valid for the IDR_xxxxIDs?

I am asking because I am using the Resource ID Organiser which seems to think that all IDs must be unique.

like image 253
manimatters Avatar asked Sep 30 '13 10:09

manimatters


2 Answers

Although it's not recommended it should work OK with different types. The API FindResource uses the ID and Type to identify the resource. The problems you're more likely to hit revolve around the way MFC uses the resource id to refer to another resource, e.g. the help text for a toolbar button. Those sort of bugs can be very time consuming so you might just want to bite the bullet now and re-number so your resource ids are unique.

like image 139
snowdude Avatar answered Nov 09 '22 06:11

snowdude


I am asking because I am using the Resource ID Organiser which seems to think that all IDs must be unique.

I thought I would just add that there is an option in Resource ID Organiser that allows for conflicts between symbol types:

ResOrg

It is not documented in the help topic.

like image 42
Andrew Truckle Avatar answered Nov 09 '22 04:11

Andrew Truckle