I have a MFC exe, trying to dynamic load a MFC dll.
// This is code in MFC exe
HINSTANCE h = AfxLoadLibrary(_T("DLL.dll"));
typedef void(*FUN)();
FUN fun = (FUN)GetProcAddress(h, "loveme");
FreeLibrary(h);
Both MFC exe and MFC dll, are having their own resource file.
However, I realize that, if MFC exe and MFC dll are having a same resource ID, conflict may occur.
// This is code in MFC dll. Both exe and dll, are having resources with
// ID 101.
CString s;
s.LoadString(101);
// Resource 101 in exe is being shown :(
AfxMessageBox(s);
May I know how I can avoid resource ID conflict problem? Can we have two resource in both MFC and DLL, although their ID is different, but they are independent from each other?
This means, DLL will only load DLL's resource. EXE will only load EXE's resource.