Re: Resource DLLs

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




"jklioe" <ranu2006@xxxxxxxxx> wrote in message news:1189486347.840843.133570@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I have created an application in MFC (Dialog based)and created
satellite dlls in different languages
and I call the dll as follow:

HINSTANCE hInstance = LoadLibrary(_T("MyAppKorean.dll"));

AfxSetResourceHandle(hInstance)

Strings that are in string table displays properly ie in locale
language .

While strings in Dialogs appears in default language ie English .

If your dialogues in the resource DLL are translated, then it should work as lomng as you are using the right resource handle at the right moment.

I do it as follows (currently with English in the programs resources and Dutch, French, German, Italian, Spanish, Swedish in separate resource DLLs.

I define a class - schematically

class MY_UI
{
//...
};

Its constructor uses AfxSetResourceHandle to set the language I want to use and remembers the previous resource handle (as a class member).

Its destructor uses AfxSetResourceHandle to reset the previous handle.

MY_UI has a member function for each dialogue box in the program, which handles the dialogue, typically of the form:

BOOL MY_UI::editSomething( SOMETHING &x, CWnd *pParent )
{
BOOL bResult(FALSE);

CDgEditSomething Dlg( x, pParent );

if( Dlg.DoModal()==IDOK )
{
x = Dlg.dgGetResult();
bResult = TRUE;
}

return bResult;
}

Then it is used with

MY_UI myui;
bResult = myui.editSomething( x, pParent )

and it just works. I set it up a year or so ago and have never had to worry about it since. I only have to remember to use dialogues always from within a member of MY_UI

Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm







.



Relevant Pages

  • Re: which resource will be used?
    ... I do not have any dlls, ... for picking up a particular language if there is no match between the ... switch to english if there is no match. ... Are you supplying the czech version of the resource dll with identical ...
    (microsoft.public.vc.mfc)
  • Re: string tables
    ... When the user selected a new language we would load the ... this be done with STRINGTABLES. ... In this case I would suggest using resource only DLLs. ...
    (microsoft.public.vc.mfc)
  • Re: Internatinalization and multiple language support without resource DLLs
    ... I never had an issue with runtime dependencies with controls. ... DLLs and the .exe, and that wouldn't happen except by accident, and, of course, this would ... a tool like appTranslator or writing a program that compared resource structures). ... resources, a French set of resources, etc., and I failed to update all the languages ...
    (microsoft.public.vc.mfc)
  • Re: Internatinalization and multiple language support without resource DLLs
    ... I never had an issue with runtime dependencies with controls. ... The dependency would be between a recently added CEdit class in the exe that will try to attach to a EDIT control in a dlg resource in a localised dll. ... DLLs and the .exe, and that wouldn't happen except by accident, and, of course, this would ... And depending on your distribution regime it might make sense not to do this. ...
    (microsoft.public.vc.mfc)
  • Re: Internatinalization and multiple language support without resource DLLs
    ... The dependency would be between a recently added CEdit class in the exe that will try to attach to a EDIT control in a dlg resource in a localised dll. ... DLLs and the .exe, and that wouldn't happen except by accident, and, of course, this would ... Now, clearly the one size fits all has some implications for organisations that really like to tinker with layouts between languages, but I propose that this ability to tinker comes at such a cost that it's not worth doing. ...
    (microsoft.public.vc.mfc)