Re: Localize MFC DLL into resource only DLLs
- From: "Serge Wautier" <serge@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 18 Dec 2007 20:43:27 +0100
I agree that it's not a good idea to load DLLs from within DllMain(). It often leads to problems. However, all the reasons I've ever seen listed do not apply to resource-only DLLs. Now, of course, I probably haven't read about all of them...
Serge.
http://www.apptranslator.com
"David Ching" <dc@xxxxxxxxxxxxxxxxxxxxxx> wrote in message news:sHT9j.14$pA7.2@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"Emmanuel V." <everguet@xxxxxxxxx> wrote in message news:2d884b8f-fb08-45c0-9ba5-9db59d93baef@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxHello,
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.
I'm using LoadLibrary("AppXXX.dll") and AfxSetResourceHandle() for my
EXE and it's working. I tried the same code in DLL_PROCESS_ATTACH in
the DllMain of Library.dll (to load resource only LibraryXXX.dll).
It's not working, I still have the default language.
I notice that, in the DLL_PROCESS_ATTACH, after LoadLibrary() and
AfxSetResourceHandle(), if I call LoadString, I get the localized one.
But when calling the same LoadString, from my EXE, I get the default
one as if I never call LoadLibrary() and AfxSetResourceHandle() from
DllMain()...
Can you help me to localize a DLL into resource only DLLs ?
It is recommended you don't call LoadLibrary() from within DllMain(). Since your DLL is in the process of being loaded, I think Windows has locked the loader in your process and therefore other DLL's cannot be loaded at this time. Can you defer this code until sometime after your DllMain is run? Perhaps you could export a function from your DLL that the .exe could call after your DLL is loaded by the .exe.
-- David
.
- Follow-Ups:
- Re: Localize MFC DLL into resource only DLLs
- From: Tom Serface
- Re: Localize MFC DLL into resource only DLLs
- References:
- Localize MFC DLL into resource only DLLs
- From: Emmanuel V.
- Re: Localize MFC DLL into resource only DLLs
- From: David Ching
- Localize MFC DLL into resource only DLLs
- Prev by Date: Re: Vista-elevation and HKEY_CURRENT_USER
- Next by Date: Re: AfxGetApp() returns NULL
- Previous by thread: Re: Localize MFC DLL into resource only DLLs
- Next by thread: Re: Localize MFC DLL into resource only DLLs
- Index(es):
Relevant Pages
|