简体   繁体   English

如何使用 AfxMessageBox 打印符号“↑”?

[英]How to print symbol “↑” using AfxMessageBox?

How can I print this symbol "↑" using AfxMessageBox() ?如何使用AfxMessageBox()打印此符号"↑"

I try to code it like this:我尝试这样编码:

AfxMessageBox("↑");

After compiling, I got a strange symbol:编译后得到一个奇怪的符号:

图片

Does AfxMessageBox() not support this symbol? AfxMessageBox()不支持这个符号吗?

Your source file is likely saved as UTF-8.您的源文件可能保存为 UTF-8。 To work with MBCS string literals, your source file needs to be saved in the same charset that your OS user locale is set to.要使用 MBCS 字符串文字,您的源文件需要保存在与您的操作系统用户区域设置相同的字符集中。 Unfortunately, not many charsets support this particular character, I think.不幸的是,我认为支持这个特殊字符的字符集并不多。 Otherwise, you have to switch to Unicode.否则,您必须切换到 Unicode。

If you can't switch the whole app to Unicode, then you can at least use MessageBoxW() instead, eg:如果您不能将整个应用程序切换到 Unicode,那么您至少可以改用MessageBoxW() ,例如:

::MessageBoxW(NULL, L"↑", L"title", MB_OK);

Or或者

::MessageBoxW(NULL, L"\x2191", L"title", MB_OK);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM