I have created this class to help me load a different resource DLL if it is present during runtime. An example would be a multi-language application. If another resource DLL (with a name specified at compile time) is present, it can load and use it as the resource for the application.
Let's look at the class header. It is quite simple and I think the comments describe well about the individual methods.
HINSTANCE m_hExternalResource; HINSTANCE m_hApplicationResource; };
Using the code
Below is an example of how you may use the methods of the class. First you need to create an object of
CResourceManager. You can put it as global or as a member of your application class. Then, call the
Setup(...) method in
InitInstance(...) as shown below.
As for cleaning up the loaded resource DLL, the destructor will handle it as shown below.
if (m_hExternalResource != NULL)
m_hExternalResource = NULL;
m_hApplicationResource = NULL;
Points of interest
I admit that this class do fall short in terms of the other resource problems that could be addressed, but feel free to extend it if you want.