Re: Localize MFC DLL into resource only DLLs
I will try this solution, but I already have a +10000 lines dll, and
what you said, is to put your object everytime I'm using resource ?
On 18 d=E9c, 16:12, "David Webber" <d...@musical-dot-demon-dot-co.uk>
wrote:
"Emmanuel V." <everg...@gmail.com> wrote in message
news:2d884b8f-fb08-45c0-9ba5-9db59d93baef@r60g2000hsc.googlegroups.com...
I have resource DLLs (for example AppXXX.dll) to localize my
applications (App.exe), but I want to localize some MFC DLLs too. For
example Library.dll which is dynamicaly loaded by App.exe, need to be
localized. So I want to create a localized LibraryXXX.dll.
The way I do it is to have a class, schematically
class RESOURCE_LOADER
{
static HINSTANCE hCurrentModule;
HINSTANCE hPreviousModule;
//...................
};
Its constructor sets the resource handle hCurrentModule of the localised D=
LL
in use (there's one for each language) and it remembers the previous
resource handle in hPreviousModule.
Its destructor resets the previous resource handle.
All loading of resources is done by members of this class. For example
BOOL RESOURCE_LOADER::editSomething( SOMETHING &something );
will invoke a modal dialogue, using the version of the resource template i=
n
the localised DLL and return TRUE with the edited version of "something".=
(There are some bells and wistles: eg it looks for the resource in the
original exe if it can't find one oin the localsation DLL.)
So now using the localised DLLs is just
RESOURCE_LOADER rl;
if( rl.editSomething( something ) )
{
// .....
}
and it all works completely transparently. [There is one member function=
per dialogue.]
I also have static methods to load simple things like strings, and always
use RESOURCE_LOADER::LoadString() instead of the usual one.
The dialogue which selects languages simply sets
RESOURCE_LOADER::hCurrentModule to the DLL for the selected language.
It all works very nicely and has required almost no maintenance since I se=
t
it up a couple of years ago.
Dave
--
David Webber
Author of 'Mozart the Music Processor'http://www.mozart.co.uk
For discussion/support seehttp://www.mozart.co.uk/mozartists/mailinglist.h=
tm