Q:

MFC App loading dialog from another DLL

We have a very big MFC application that have 16 projects in the solution. Each project is a DLL. Four(4) of these projects are what we call "Network". In each network, there is a dialog that we will call X. This dialog is VERY different in each of the network but the name of the dialog itself is the same in each of the resource.h. In resource.h, they also have the same ID (value).
What happend right now is that when I'm on the network 1 and load the class with the dialog X, it try to use the dialog from Network 2. Since they don't have all the same control in it, it crash in the DoDataExchange trying to find controls that don't exist in the other network.
Does anybody know what can cause this? Attemps at changing the name in the network that do not work didn't change anything since it use the ID...
I always think that the DLL was using it's own resource.h but now it's seems that it's not the case...
Can anybody help?
Thanks

A:

It sounds like you need to call AfxSetResourceHandle to specify the DLL from which to load the dialog.
Edit: Given your description, you'll basically need to call this with the right value every time you display a dialog. Changing things like the DLL load order isn't going to fix the problem -- at any given time, MFC is going to try to use one order for the DLLs/EXE to load all dialogs, and this is modal, so it stays the same until you change it. Given the same resource ID needing to refer to different resources at different times, you need to tell it which one at any given time -- otherwise, you get the first thing it finds with the right ID, and almost no control over which that will be.

