News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Static control refuses to display Unicode

Started by jj2007, November 21, 2023, 08:53:10 AM

Previous topic - Next topic

jj2007

This cost me half a day of bug chasing, so I'll share the solution with you:

I have a static control that until recently worked fine, displaying Russian text (my favourite test language). Then it stopped and showed only ???????...

Long story short: the control is subclassed using...

mov opControl, rv(SetWindowLong, hStatic, GWL_WNDPROC, offset WndProcChild)
...
invoke CallWindowProc, opControl, hWnd, uMsg, wParam, lParam

Straightforward, isn't it? But it shows ???? where Документ was expected. One single char more solved the problem: SetWindowLongW

NoCforMe

Good catch. Moral of the story: know thy Unicode from thy ANSI. (I've never used SetWindowLongW(), since I don't have to mess with that Unicode stuff.)
Assembly language programming should be fun. That's why I do it.

jj2007

Setting and displaying Russian was the only problem with the subclass, everything else worked as usual.

It's weird that Windows apparently provides two subclassing options:

QuoteThe operating system automatically translates messages into Windows (ANSI) code page or Unicode form, depending on the form of the function that has subclassed the window procedure.

TimoVJL

Quote from: jj2007 on November 21, 2023, 11:20:09 PMSetting and displaying Russian was the only problem with the subclass, everything else worked as usual.
As usual with ... :biggrin:
May the source be with you