思路: 根据各国语言的不同,构建不同语言包的DLL。
::MessageBoxW(NULL,cla_kodlogic->GetMsgString(1712),cla_kodlogic->GetMsgString(1716),MB_OK);
上面的1712和1716分别为DLL中字符串对应的索引。
1. 动态修改窗体的Caption:
1.AfxGetMainWnd()->SetWindowText("测试标题");
2.this->SetWindowText("测试标题");
2.动态修改菜单弹出项的文字:
DWORD dwPos = GetMessagePos();
CPoint point( LOWORD(dwPos), HIWORD(dwPos) );
CMenu menu;
VERIFY( menu.LoadMenu( IDR_R_MENU ) );
CMenu* popup = menu.GetSubMenu(0);
ASSERT( popup != NULL );
popup->ModifyMenu(ID_32771,MF_POPUP,ID_32771,cla_kodlogic->GetMsgString(1714));
popup->ModifyMenu(ID_32772,MF_POPUP,ID_32772,cla_kodlogic->GetMsgString(1715));
popup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this );
(ModifyMenu函数中参数的具体意义,可以参考: http://www.programfan.com/doc/vbapi/ModifyMenu.htm )
3.修改某列表控件内文字的显示大小(在OnInitDialog函数内加入即可):
CFont* font = GetFont();
static CFont g_Font;
if (font)
{
LOGFONT lf;
font->GetLogFont(&lf);
//lf.lfWeight = 1;
lf.lfHeight += 25;
lf.lfWidth += 6;
g_Font.CreateFontIndirect(&lf);
// Newdfont.CreatePointFont(160, "宋体");
//CListCtrl &m_List = GetListCtrl();
m_ListSong.SetFont(&g_Font,TRUE);
m_ListSinger.SetFont(&g_Font,TRUE);
CWnd *pCtrltrol=NULL;
if(NULL != (pCtrltrol = GetDlgItem(IDC_STATIC_SONGLIST)) )
pCtrltrol->SetFont(&g_Font,TRUE);
}