我怎样使自己的程序可以支持中英文界面,并且可以自由切换?

piaorenqian 2002-11-18 02:41:26
我怎样使自己的程序可以支持中英文界面,并且可以自由切换?
比如:现在程序是中文界面,有个老外过来了,他希望这个程序的界面是英文,这时用菜单就可以切换成英文界面,该怎么办啊。
方法1.做两套
方法2.用String Table,可是怎么用啊?有比较好的解决方法么。
...全文
159 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
nevergrief 2002-11-18
  • 打赏
  • 举报
回复
0.建立 应用程序 APP
1.建立 应用程序 默认语言的资源

2.生成 DLL 工程: 如 Chinese.DLL / English.DLL
3.在 DLL 工程中加入合适的语言版本资源: Chinese / English
4.注意:资源 ID 必须一样!

然后:在程序中->

BOOL CLanguagesApp::InitInstance()
{
AfxEnableControlContainer();

// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.

//********************************************************************
// Judge the default lanuage ID of Windows System
WORD wLangID=PRIMARYLANGID(::GetSystemDefaultLangID());
switch(wLangID)
{
case LANG_CHINESE:
//m_hLangDLL=AfxLoadLibrary(_T("Chinese.DLL"));
//break;
default:
m_hLangDLL=AfxLoadLibrary(_T("English.DLL"));
break;
}
if(!m_hLangDLL)
{
AfxMessageBox(_T("Unable to load resource DLL!\n\rUse self-resource!"));
}
else
{
AfxSetResourceHandle(m_hLangDLL);
}
//********************************************************************

#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));

LoadStdProfileSettings(); // Load standard INI file options (including MRU)

// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.

CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CLanguagesDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CLanguagesView));
AddDocTemplate(pDocTemplate);

// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);

// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;

// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();

return TRUE;
}

wj59 2002-11-18
  • 打赏
  • 举报
回复
帮你UP
qing_li73 2002-11-18
  • 打赏
  • 举报
回复
See the sample below, FYI :

http://www.programsalon.com/download.asp?type_id=13&pos=80
qing_li73 2002-11-18
  • 打赏
  • 举报
回复
use different DLL files to load the relative resource
nbgyf 2002-11-18
  • 打赏
  • 举报
回复
请参考我的总结:

http://expert.csdn.net/Expert/topic/1149/1149715.xml?temp=.6321985

希望能解决您的问题

15,978

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧