Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using ↺ on a button in Win32 GUI

I'm making a Win32 GUI application and I want to display the ↺ character on a button.

Normally, I think one would insert a unicode character like this:

HWND button = CreateWindow("BUTTON", "\u27F3",
        WS_TABSTOP|WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON, size - 105,
        size - 29, 100, 24, hwnd, (HMENU)IDI_BUTTON,
        GetModuleHandle(NULL), NULL);

where "\u27F3" is the unicode character described here under "C/C++/Java" http://www.fileformat.info/info/unicode/char/27f3/index.htm

However, when I do this I don't get the arrow character but a different one? What's going wrong?

Thanks!

like image 238
beenjaminnn Avatar asked Feb 17 '23 10:02

beenjaminnn


1 Answers

I'm going to shamelessly steal from Raymond Chen's comment and show the corrected code:

HWND button = CreateWindowW(L"BUTTON", L"\u27F3",
        WS_TABSTOP|WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON, size - 105,
        size - 29, 100, 24, hwnd, (HMENU)IDI_BUTTON,
        GetModuleHandle(NULL), NULL);

Naturally the font you have selected into the window will need to support the character.

like image 182
Mark Ransom Avatar answered Feb 20 '23 04:02

Mark Ransom