主要分两步:
1、所使用的资源xxx.rc的中修改代码如下:
1 // Chinese (P.R.C.) resources 2 //这是中文 3 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) 4 #ifdef _WIN32 5 LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED 6 #pragma code_page(936) 7 #endif //_WIN32
1 // English (U.S.) resources 2 //这是英文 3 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 4 #ifdef _WIN32 5 6 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 7 8 #pragma code_page(1252) 9 #endif //_WIN32
2、在程序调用前添加判断代码:
1 WORD wLangPID = PRIMARYLANGID(GetSystemDefaultLangID()); 2 if(LANG_CHINESE == wLangPID) 3 { 4 AfxMessageBox("this is chinese os"); 5 }else 6 if(LANG_ENGLISH == wLangPID) 7 { 8 AfxMessageBox("this is english os"); 9 }