2012-11-12 29 views
0

可能重复:
Display both of Korean and Chinese language in C++显示中国在VC++ 6

我有已建成的VC++ 6.0的问题是一个游戏的源代码,当我尝试在消息框(在游戏界面中显示的定制消息框)中显示中文消息,中文消息总是被打破。

这是函数:

BOOL Message_Box(char * msg, int Button, void (*pProcOK)(), void (*pProcCancel)()){ 
    CMsgDlg dlg; 
    int nCnt = 100; 
    int nIndex = 0; 
    do { 
    nIndex = FindMsgDlg(nCnt); 
    if(nIndex == -1) 
     break; 
    nCnt++; 
    } while(true); 
    dlg.SetDlg(g_hMainWnd, nCnt, Button, msg, pProcOK, pProcCancel); 
    g_vtDlgList.push_back(nCnt); 
    g_vtMsgBox.push_back(dlg); 
    ShowDlg(dlg.GetIndex()); 
    return FALSE; 
} 

我打电话:

Message_Box("你没有足够的钱进入房间。", MB_OK); 

这是结果,当它显示在消息框:

??有足?的??入房? 
+0

你又来了!你永远不会完成这个问题,并离开... – billz

+0

不知道什么Billz意味着说“你永远不会完成问题”,但无论如何,没有C++ 11功能,你应该使用MultiByteToWideChar()函数。请参阅此线程中的解决方案4,可以提供帮助 - http://www.codeproject.com/Answers/488485/Unicode-arabicpluscharacters-pluscontentplusfrompl?cmt=351401#answer4 – SChepurin

回答

1

你应该使用unicode的API要显示中文字符,也应该将它们存储在unicode中