Displaying Japanese, Chinese, Viatnamese, etc in C++ window menu

非 Y 不嫁゛ 提交于 2019-12-11 18:05:53

问题


I was making a program that could display different languages once pressed, but when it came to making the LPSTR in my menu to display the Japanese option, it wouldn't display the Japanese characters. It just displayed "???".

Here is a screenshot of my program:

Here is the code that doesn't work:

I tried this:

        AppendMenu(win32LANGUAGE,MF_STRING,NULL,"日本人");

and this:

        wchar_t jap = "日本人"; 
        AppendMenu(win32LANGUAGE,MF_STRING,NULL,(LPSTR)jap);

I am stuck. I don't know why it won't display the Japanese characters. Thanks in advance.


回答1:


If your compiler doesn't throw an error on AppendMenu then you probably haven't defined the UNICODE macro, try using AppendMenuW, set jap (which should be a wchar_t const*) to L"日本語", and don't cast it.



来源:https://stackoverflow.com/questions/15983526/displaying-japanese-chinese-viatnamese-etc-in-c-window-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!