|
It is not considered good etiquete to email a 5MB file to someone, I am on dialup, it took 30 minutes to downlaod.
As I said I can not help you sort out your programming problems, if you feel that my solution does not work, then I suggest you use a different one.
I apprecaite English is not your first language, so do not take these point too personally.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for - in order to get to the job you need to pay for the clothes and the car, and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
|
|
|
|
|
Hi,
Thanks, to this great product!
I implement the Internationalization and Multiple Language Support in my MDI application. In application there is 3(three) menus - IDR_MAINFRAME, IDR_SCINTITYPE and IDR_POPUP. I have any problem on load menus IDR_SCINTITYPE and IDR_POPUP. Application is crash if change language to other! If no opened document in myframe menu IDR_MAINFRAME work properly! If yes opened document menu IDR_SCINTITYPE not loaded(not work) and application crash! Please help mi to this problem!
Sorry of my lost English!!!
Thanks, Krasimir Stoychev
|
|
|
|
|
I am sorry I can't really help you without seeing your application.
What I would suggest is that you create a new language DLL by copying your RC file data and calling it say English do not modify the code and simply use this DLL as a new language.
If this fails then there is a fault elsewhere in your code, it could me a memory overwrite somewhere, by changing the language, the fault appears.
Once it is working simply change 1 line of text to prove that the correct DLL is being loaded.
"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 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
|
|
|
|
|
|