Re: Localize MFC DLL into resource only DLLs
OK, so you mean that for from the exe, you call a function in your dll that
in turn loads a resource, right?
Is it an MFC extension DLL or a regular MFC DLL (one that simply uses MFC) ?
If it's an regular MFC DLL and you have an exported function which is, say:
bool PopupDialog()
{
CMyDialog dlg;
return dlg.DoModal()==IDOK;
}
than you need a call to AFX_MANAGE_STATE() to correctly handle resource
handles:
bool PopupDialog()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CMyDialog dlg;
return dlg.DoModal()==IDOK;
}
I haven't done that for long so you should watch for inaccuracies but you
get the idea.
HTH,
Serge.
http://www.apptranslator.com - Localization tool for your MFC applications
"Emmanuel V." <everguet@gmail.com> wrote in message
news:49452108-c3a0-410e-8926-5e2abf67f1f2@q77g2000hsh.googlegroups.com...
On 18 d9c, 18:01, "Serge Wautier"
<serge_dontusethisaddr...@mailinator.com> wrote:
You try to load a string in LibraryXXX.dll by calling LoadString from the
exe? How do you expect this to work out of the box? I'm confused.
Which hInstance do you use in LoadString() ?
No, loading a string was just an example (using a breakpoint in my DLL
code to see what string was loaded). For example, I have a CDialog
derived object in Library.dll, and I want the localized one to be
used, and my problem is that just default one (in Library.dll) is
used.
Do you use AFX_MANAGE_STATE() in your DLL's exported functions? IIRC, it
takes care (among other things) of switching back and forth the correct
resource handle (AppXXX.dll vs LibraryXXX.dll) when entering/leaving the
DLL.
I don't know what AFX_MANAGE_STATE() is.. I have to check MSDN :)
Thanks.