|
Hi i am testing this Demo, and tried a few things
sorry for my English, hope i can make this clear
i found one French ASCII code String "pav?num廨ique", has some display problem
and put on LangFra.rc, i put that string above, to all the different dialogs
, code can successfully compiled, but the result is different in some dialogs,
[Operation Procedures]
1. Language -> French <change to="" french="" mode="" first="">
2. Correct Displays
at 1537 DIALOG, i changed one random Lable Caption to "pav?num廨ique", it works ok
also at IDR_MAINFRAME MENU, changd one of the random Caption to "pav?num廨ique", it displays ok too
(when it display ok it will appear a little coma(,) things on top of [e]
3. Error Displays
at AboutBox Dialog, tried to change one random Lable Caption to the above string, but it don't have little (,)coma on top of it
at void CChildView::OnPaint(), changed dc.TextOut() to the "pav?num廨ique", also display wrong
so the conclusion i guess after i load LoadLibrary(_T("LangFRA.dll"));
only some Dialog will be affected, but some others don't
can you please help me to fix this problem?
ps. can i have your email address i can upload my demo file to you, and you can clear see where's the problem, thank you very much
|
|
|
|
|
Feel free to email me your code, I suggest you try clicking the email button. But it could take me a day or two to look at your code, I am busy at the moment.
The error you are geting could be due to the editor you are using, I tend to use pspad http://www.pspad.com/[^] to edit the RC file, and depending on how it is set some non English characters are incorrectly saved/displayed.
BTW your Enlish is fine, better than my French!
Au Revoir
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
Works great except for a docked DialogBar that I have docked to the program. I dock at OnCreate in my CMainFrame and when I change the language, it doesn't change. How can I fix this.
|
|
|
|
|
I would assume that you need to repaint the elements of the dialogbar, as I state in the article for a menu
The menu has to be changed to be the one from our resource DLL. It should be noted that we need to get the menu from the CMainFrame, this is because we in effect need to force a change of any elements that are currently displayed. The dialog boxes, as you will see will be displayed in the correct language automatically, in this example, the About box.
I have never tried with a dialog bar, but as I mention some elements have to be 'repainted' manually.
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
OK, I figure out how to do it. I keep trying to DestroyWindow so I can Create the Dialog Bar again but it keep crashing. I figured out that I have to FloatControlBar before I can DestroyWindow. So, It can be done. Thx again.
|
|
|
|
|
Thanks for posting the solution, I am sure it will help others
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
Hi,
Very good article,
But I have a problem with dialogs in a resource-only dlls,
I want to show a dialog with codes,
cheers,
Thanks.
|
|
|
|
|
dSolariuM wrote:
I want to show a dialog with codes
Could you explain what you mean by this please?
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
Hi,
I have 2 dlls that one of them contains :
Dialogs,Bitmaps,Flash files,Binary files and etc.
The Dialog in this DLL has some buttons,Lists,Menus and etc.
The second DLL must have codes for these buttons and other objects in the Dialog.
And an exe file that must link these dlls.
My Question is:
What is the best way to relate these dlls?
Cheers,
Thanks.
|
|
|
|
|
All a language DLL is, is a cut/paste of the original lnaguage resources. You then translate the all the text strings, and probably increase/decrease the size of some of the fields as the new text may be longer than the old language, e.g. the last one I did was from English to German and teh German texts were much longer that their English equiivalents.
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
Hi have one problem.
And as i found later you already tried to find solution.
Still this not works me.
I look in FILEOPEN.DLG and your MultiLang.rc
I add to you MultiLang.rc "New File Open and Save As Dialogs" from FILEOPEN.DLG
i take NEWFILEOPENORD DIALOG section.
Lets say 1547.
Now ofn.lpTemplateName = MAKEINTRESOURCE(1547);
But GetOpenFileName(&ofn) don't show Dialog.
DWORD dwErr = CommDlgExtendedError();
dwErr 12289
What can be reason ?
What i added in the MultiLang.rc (and othe languages)file is:
1547 DIALOG DISCARDABLE 0, 0, 280, 164
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CONTEXTHELP | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "Open"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Look &in:",1091,7,6,27,8,SS_NOTIFY
COMBOBOX 1137,36,3,138,300,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED |
CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
LTEXT "",1088,172,2,102,17,NOT WS_VISIBLE | NOT WS_GROUP
LISTBOX 1120,4,20,272,85,LBS_SORT | LBS_NOINTEGRALHEIGHT |
LBS_MULTICOLUMN | NOT WS_VISIBLE | WS_HSCROLL
LTEXT "File &name:",1090,5,112,48,8,SS_NOTIFY
EDITTEXT 1152,54,111,155,12,ES_AUTOHSCROLL
LTEXT "Files of &type:",1089,5,131,48,8,SS_NOTIFY
COMBOBOX 1136,54,129,155,100,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
CONTROL "Open as &read-only",1040,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,54,148,74,10
DEFPUSHBUTTON "&Open",IDOK,222,110,50,14
PUSHBUTTON "Cancel",IDCANCEL,222,128,50,14
PUSHBUTTON "&Help",1038,222,145,50,14
END
Anatoly
|
|
|
|
|
Sorry, off hand I can't help you.
I would suggest that you check what the error code you are getting is, it may help you.
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
I also get "FNERR_SUBCLASSFAILURE", "An attempt to subclass a list box failed because sufficient memory was not available."
And Dialog is not displayed.
I can not see your rc file here:
http://ndrw.co.uk/cp/MultiLang.rc
Any ideas ?
Thanks
Anatoly
|
|
|
|
|
All I can suggest is you try googling for a solution.
It looks like that direftory on my webserver has been lost, it was just a copy of what is on CP
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
Hi, I'm having some troubles trying to add to the several languages interface some custom controls. There are any problem with custom controls?
thx
|
|
|
|
|
Hi,
I can't use multilanguage if a dialog contents a custom control, in this case, I can load the library OK, and mulilanguage run OK, but when I try to do the DoModal (); for a dialog with a custom control, it fails (I think it happens for a template), and the execution continues. But only if the actual language is a DLL language, in the default app project language the custom controls runs OK, and I can't understand why!.
If you try to add a custom control in a dialog of your project, you doesn't need to have a real custom control developed by you, only, put a custom control rect in a DLL dialog and you'll see what happens.
Have you any idea what may be happening?
Thank you very much!
|
|
|
|
|
Anybody have some idea?
|
|
|
|
|
Combine window style with "CS_GLOBALCLASS"
CString strMyClass = AfxRegisterWndClass(
CS_VREDRAW | CS_HREDRAW | CS_GLOBALCLASS,
::LoadCursor(NULL, IDC_ARROW),
(HBRUSH) ::GetStockObject(WHITE_BRUSH),
::LoadIcon(NULL, IDI_APPLICATION));
|
|
|
|
|
Hi and pleased to meet you!
Until today I was very busy doing another things and can't think more in the DLLs language system, but now I try it again and there was your post... IT WORKS!!! THANK YOU VERY MUCH!!! I never will found the answer without your help.
Good luke. C U later.
|
|
|
|
|
Hi, at first I want to apologise for my bad English.
This is a great article, and it help me a lot of, but I've two troubles,
1.- I can change my App interface language on the fly, but I have to initialize all the strings manually, do you know if it is normal?
int CIdiomasDLLDlg::iPonerIdioma (IDIOMA idIdioma)
{
int iErr = ERR_OK;
CString csBuffer = "";
CWnd* pCadena1 = GetDlgItem (IDC_CADENA_1);
CWnd* pCadena2 = GetDlgItem (IDC_CADENA_2);
CWnd* pCadena3 = GetDlgItem (IDC_CADENA_3);
CWnd* pCadena4 = GetDlgItem (IDC_CADENA_4);
CWnd* pCadena5 = GetDlgItem (IDC_CADENA_5);
CWnd* pCancel = GetDlgItem (IDCANCEL);
CWnd* pEspanol = GetDlgItem (IDC_ESPANOL);
CWnd* pEnglish = GetDlgItem (IDC_ENGLISH);
HINSTANCE hInst = NULL;
switch (idIdioma)
{
case ESPANOL:
default:
{
if (m_hInstEspanol)
AfxSetResourceHandle (m_hInstEspanol);
hInst = m_hInstEspanol;
break;
}
case ENGLISH:
{
m_hInstEnglish = LoadLibraryEx (ENGLISH_DLL, NULL, LOAD_LIBRARY_AS_DATAFILE);
if (m_hInstEnglish)
AfxSetResourceHandle (m_hInstEnglish);
hInst = m_hInstEnglish;
break;
}
}
csBuffer.LoadString (IDC_CADENA_1);
pCadena1->SetWindowText (csBuffer);
csBuffer.LoadString (IDC_CADENA_2);
pCadena2->SetWindowText (csBuffer);
csBuffer.LoadString (IDC_CADENA_3);
pCadena3->SetWindowText (csBuffer);
csBuffer.LoadString (IDC_CADENA_4);
pCadena4->SetWindowText (csBuffer);
csBuffer.LoadString (IDC_CADENA_5);
pCadena5->SetWindowText (csBuffer);
csBuffer.LoadString (IDCANCEL);
pCancel->SetWindowText (csBuffer);
csBuffer.LoadString (IDC_ESPANOL);
pEspanol->SetWindowText (csBuffer);
csBuffer.LoadString (IDC_ENGLISH);
pEnglish->SetWindowText (csBuffer);
m_hIcon = LoadIcon (hInst, MAKEINTRESOURCE (IDI_ICONO_IDIOMA));
SetIcon (m_hIcon, TRUE);
SetIcon (m_hIcon, FALSE);
Invalidate (TRUE);
return iErr;
}
2.- When I run my app, I try to initialize the language automatically on all dialogs without code in each one, not on the fly, but when I run the App it doesn't works:
BOOL CIdiomasDLLApp::InitInstance()
{
HINSTANCE m_hInst = NULL;
m_hInst = LoadLibraryEx (ENGLISH_DLL, NULL, LOAD_LIBRARY_AS_DATAFILE);
if (m_hInst)
AfxSetResourceHandle (m_hInst);
AfxEnableControlContainer();
Enable3dControls();
CIdiomasDLLDlg dlg;
m_pMainWnd = &dlg;
dlg.DoModal();
return FALSE;
}
when I do the dlg.DoModal (); it returns -1 and I can't understand why, may you help me?
Thank you very much
|
|
|
|
|
Glad you like it.
You only need to manually update text strings such as the menu etc. i.e. what is currently displayed on the screen, if you the select a new dialog box the text should be in a different language.
A simple way is in the OnInit of a diaog box/window is to manually update the text strings if it does not work automatically.
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
|
Hi again, I found the solution for my troubles, now I can initialize all my app interface language in one code line.
I never can do it without your article, thank you very much.
See you later.
|
|
|
|
|
Glad to have helped.
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
Hi, DLL system is running ok, thanks, but I'd like that the strings for lang
uage interface where in a txt file, or some file like resource.rc that I can
change automatically with a parser in a second app.
If I can change the language by this way, users may change the interface to
their own language and I haven't got to worry for this, but they can't do it
if the language is compiled in a DLL.
I can have all the strings in a txt file and load it in the OnInitDialog, bu
t this is a too large job.
Can I use the resources in a externel txt file, like a resource.rc?
c u later.
|
|
|
|
|