I have to implement multi language program.
My idea is to have several resources files with each resource duplicated with the same id (one for each language).
But how could I dynamically change the used resources file in my program ?
Printable View
I have to implement multi language program.
My idea is to have several resources files with each resource duplicated with the same id (one for each language).
But how could I dynamically change the used resources file in my program ?
Check out LoadLibrary(), FreeLibrary()
Regards,
Paul McKenzie
I have found success by creating resource only DLLs, one for each language to be supported.
In the "static" case, load the appropriate resource DLL in your apps InitInstance method. The code would look something like:
m_hResDLL = LoadLibrary( "LanguageResource.DLL" );
AfxSetResourceHandle( m_hResDLL );
In the "dynamic" case, you could add a menu to allow the user to select the language and free the previous resource DLL and load a new one. I have never done this, so I don't know if there are any problems forcing everything to be repainted in the new language.
- Rich Bietz
Ok fine. The solution seems to be the correct one.
But could you shortly explain how to develop a resources DLL (just the main steps to make and build one using mfc) ?
Thansk for all.
Ok fine. The solution seems to be the correct one.
But could you shortly explain how to develop a resources DLL (just the main steps to make and build one using mfc) ?
Thansk for all.
Create an empty DLL project and just edit the resources by adding your strings. Make sure that the ID's you give the strings match the ID's in your other resource DLL's. Then build the DLL, and you should be Ok.
The VC on-line help has more info on how to do this.
Regards,
Paul McKenzie