Is it possible to use unicode characters in a Win3

2019-05-09 15:53发布

I have a Win32 program where the main window is a dialog box, so I can create all the controls using the resource.rc file. I'm stuck at creating a button using a unicode character though. It works with using the CreateWindowEx() function, but not in the resource file. Why is that?

I've tried the following lines of code in my resource file:

#include <wchar.h> // tried with and without this header file
// also tried defining UNICODE but i got an error saying it was already defined
CONTROL "\u2190", IDC_BACK //...more stuff
CONTROL L"\u2190", IDC_BACK //...more stuff

1条回答
唯我独甜
2楼-- · 2019-05-09 16:51

To use non-ASCII characters in a resource, you can either save the .rc file in UTF-16 with a BOM, or else save the file in Ansi and use a #pragma codepage directive to indicate the file's codepage. I would suggest UTF-16. Either way, you can then use the actual character instead of using "\u":

CONTROL "←", IDC_BACK
查看更多
登录 后发表回答