4

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
KonstantinL
  • 667
  • 1
  • 8
  • 20
Vince
  • 2,596
  • 11
  • 43
  • 76

1 Answers1

6

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
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770