Re: resource dll problem
- From: "David Webber" <dave@xxxxxxxxxxxxxxxxxxx>
- Date: Sun, 10 Dec 2006 14:00:17 -0000
"Ajay Kalra" <ajaykalra@xxxxxxxxx> wrote in message
news:u9iqAvtGHHA.924@xxxxxxxxxxxxxxxxxxxxxxx
Why should you have the same resource IDs in the main program and a DLL?
These IDs shoudl all be distinct or you need to explicitly ask for
resources
from a specific DLL. We used multiple resource DLLs, all with distinct
resoruce IDs and put these in a resource chain using CDynLinkLibrary.
I do it the way adamus suggests (same resource IDs in different language
modules) and it works fine.
Schematically I have a
class USERMODULE
{
static HINSTANCE mu_hInstance;
static HINSTANCE mu_hModuleLanguage;
HINSTANCE mu_hOldInstance; // Previous resource instance handle set in
AFX
// member functions...
};
If a foreign language has been selected then
mu_hModuleLanguage
is the handle of the appropriate resource DLL. Otherwise it is NULL.
mu_hInstance is the handle of the standard (English) resource module.
The constructor of this class sets mu_hOldInstance from
AfxGetResourceHandle() and uses AfxSetResourceHandle() to the desired
module. The destructor sets things back with
AfxSetResourceHandle( mu_hOldInstance )
All dialogue operations are wrapped in member functions of this class and
all resources are loaded by preference from mu_hModuleLanguage (if it is
non-NULL) and from mu_hInstance on failure. There's also a static
muLoadString() member which can load strings from the appropriate string
table without constructing a USERMODULE or telling AFX about anything.
It all seems to be working a treat!
Dave
--
David Webber
Author MOZART the music processor for Windows -
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm
.
- Follow-Ups:
- Re: resource dll problem
- From: Ajay Kalra
- Re: resource dll problem
- References:
- resource dll problem
- From: adamus
- Re: resource dll problem
- From: Ajay Kalra
- resource dll problem
- Prev by Date: Re: Programming for Vista ?
- Next by Date: Re: resource dll problem
- Previous by thread: Re: resource dll problem
- Next by thread: Re: resource dll problem
- Index(es):
Relevant Pages
|