i have an not Unicode MFC Application, programmed in Visual Studio 2010 with C++. For translating my software, i have extraced all the resources into a resource -dll. This dll is translated with a tool, visual localize, to russian language i.e.. .
I load the dll with
this->m_hLanguageDLL=LoadLibrary(csFullDllName);
...
AfxSetResourceHandle(m_hLanguageDLL);
..
Most parts work well, but some text is displayes as ???? only. I reduced the problem to text, that is loaded from the resource with
CString csTmp;
...
csTmp.Format( IDS_STRING246 );
this results in the wrong text.
Can anybody give me a clou, what is wrong with this concept or how to get the correct behavior. Opening the dll in Visual Studio, the text entries are translated correctly.
... the "Hello World!" does not appear in the dll so my client cannot translate it.
What do you mean by "does not appear in the dll"?
It cannot appear there automatically, it is you who has to put this text in the dll string table!
After you put ii in the string table you should use CString::LoadString to load it in the CString object.
Same result. Of course the string is in the resource file. It is found in the english, german, ... version. The russian recource-dll also contains the string.
Please, show your actual code that icludes loading the string and using it to be shown in UI!
And please, stop posting some pseudo code patterns, especially because they are different in your every new post.
and the result is a message box with only ???????????
If i use LoadString instead of Format the same result. The number of ? is the same as the letters in the text.
No, in the dll loaded, the IDS_STRING is allready translated to russian. I found out something new. If i use this code:
wchar_t buf[256];
AfxLoadString(IDS_STRING663,buf,256);
csTmp=buf;
in buf the text is correct. Then converted to CString csTmp it results in the ????????
The default conversion from wide char to MBCS is done using WideCharToMultiByte API which first paramaeter (CodePage ) defines how to convert.
ATL CString uses _AtlGetConversionACP() function to obtain the CodePage and the return value seems to not correspond the page you need to the proper conversion. See details here
i finally found out, it was not a coding problem, but a problem in the settings of Windows. With the correct settings and the russian language installed correctly, the dialogs are displayed correct and also the messages load correct. Either with Format or LoadString.
Bookmarks