Reputation: 1328
In MFC C++, When we add a new resourcein a EXE, says string, it will generate an ID automatically:
#define ID_SHOW_OUTPUT 10313
When it has a plugin(DLL) which has the similar ID, it will cause undefined behavior after trigerred.
To play safe, I tried to define the my own private ID:
#define ID_SHOW_OUTPUT (WM_APP+6)
However, I will have a lot of work if there are hundreds of resources in the EXE and DLL.
I'm not sure there is a better solution and prevention on duplicated resource ID across executables???
Upvotes: 1
Views: 2286
Reputation: 2831
Check this add-in. It gives you a higher control over resource ids.
As Luke commented, there should not be problems using DLLs with duplicte resource ids. Only one resource module is active at a time using AfxSetResourceHandle
Setting Command IDs to arbitrary UINT
values (In your question you assigned WM_APP + 6
to a command ID) is not safe since these values are interpreted by MFC in many places. Check this StackOverflow question for more details.
Upvotes: 4