VC开发多语言界面支持的简单方法(2)
配置文件实例:
配置项解释:Section:[Login Dialog]:界面窗口;等号左边:窗口中需要设置其Caption属性的组件ID;等号左边:窗口中需要设置其Caption属性的组件Caption值;
[Login Dialog]
1001 = 用户帐号
1002 = 用户密码
1017 = 登 录
1018 = 退 出
语言包配置信息加载代码:
BOOL CLanguageManager::loadFromFile()
{
BOOL bRead=FALSE;
int i;
ItemContext temp;
CStringArray itemBuf,valueBuf;
bRead = fileManager.GetSectionValues("Main Window",itemBuf,valueBuf);
if(bRead)
{
for(i=0;i<itemBuf.GetSize();i++)
{
temp.uCtrlID = atoi(itemBuf.GetAt(i));
temp.strContext = valueBuf.GetAt(i);
m_vtContexts.push_back(temp);
}
}
itemBuf.RemoveAll();
valueBuf.RemoveAll();
bRead = fileManager.GetSectionValues("Login Dialog",itemBuf,valueBuf);
if(bRead)
{
for(i=0;i<itemBuf.GetSize();i++)
{
temp.uCtrlID = atoi(itemBuf.GetAt(i));
temp.strContext = valueBuf.GetAt(i);
m_vtContexts.push_back(temp);
}
}
return bRead;
}
- 上一篇:在VC6中编写可在XP中显示XP风格界面的程序
- 下一篇:vc开发html编程