AfxMessageBox(L"Test", MB_YESNOCANCEL | MB_ICONQUESTION);
I want this text on the button in English.
1. I've alread created the project with Engilsh Language option in the wizard.
2. I modified the .rc file language section:
/////////////////////////////////////////////////////////////////////////////
// Chinese (Simplified, China) resources
//#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) //LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
It's still in Chinese. Do I have to change my PC to English? I don't think so.
The code below works on my computer.
MessageBoxEx(AfxGetMainWnd()->m_hWnd, _T("Test"), AfxGetAppName(), MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL, MAKELANGID(LANG_GREEK, SUBLANG_GREEK_GREECE));
Neither the AfxMessageBox()
nor the CWnd::MessageBox()
functions have an overloaded form taking a language/sublanguage identifier or name, so you have to use the Win32 MessageBoxEx()
one.
I have both English and Greek installed, and the default language (UI and system ANSI codepage) is English. Also tried French but it didn't work (defaulted to English). So it works if the specified language is actually installed, even if it's not the thread's current or preferred language; changing it may cause side-effects (eg affecting other UI items as well) and you may likely want to revert it back to Chinese.