Web Development

Our forums are currently in maintenance mode and the ability to post is disabled. We will be back up and running as soon as possible. Thanks for your patience!

General discussion


"Hidden" resources in extension DLL's

By debate ·
Tell us what you think about "hidden" resources in extension DLL's, as featured in this week's Software Development e-newsletter. Do you have any horror stories about DLL's darker side? How would you respond if faced with this problem: MFC assumes that all of the applications' resources reside in the main executable?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

More Notes re: Locating Resources

by ScottVS In reply to "Hidden" resources in ext ...

Here are other techniques which are also helpful (it looked like maybe your note at the end of the article may have been alluding to this):

Use AfxSetResourceHandle to specify the location of your resources when necessary. Usually it is good to save the current value and restore it when you are done. (AfxGetResourceHandle, etc.)
Also, export a function from your DLL to allow for anyone to get the resource handle easily from anywhere. Something like GetMyResourceHandle which returns the handle to be used in the call to AfxSetResourceHandle or the "raw" Win32 LoadString or something like that. I have found it helpful to create a separate DLL with all of my strings with a COM and API way to talk to it, especially if the strings need to be translated into multiple languages.

One other thing to be aware of is that the MFC AfxFindResourceHandle will search for the FIRST match in the DLL chain with the requested ID/resource type. There is no way to modify the order of the chain, itis according to the DLL file name. If you don't use a global include file for resource IDs strange things can happen.

Related Discussions

Related Forums