[ros-kernel] Ansi/Unicode windows

Ge van Geldorp ge at gse.nl
Thu Dec 18 11:10:11 CET 2003


> From: Filip Navara
> 
> but when the window class is registred in comctl32 as unicode 
> and then ANSI application creates the window of that class, 
> the new window is ANSI and not UNICODE (as the class).

I don't think so. Let's take the ListView as an example. The class is
registered in listview.c using RegisterClassW. The window proc passed in
the WNDCLASS structure is LISTVIEW_WindowProc. That window proc expects
Unicode messages (just look at the DefWindowProcW() near the bottom).

Now, if you create a window of this class using CreateWindowA, you don't
change the window proc. So the window proc of this new window is still
LISTVIEW_WindowProc and it still expects Unicode messages: the new
window is a Unicode window, in spite of being created using
CreateWindowA.

When you then call SendMessageA from the Ansi app, the message is
actually translated from Ansi to Unicode by MsgiAnsiToUnicodeMessage()
in lib/user32/message.c, the Unicode message is delivered to the window
proc and upon return the (Unicode) reply is translated back to Ansi
(MsgiAnsiToUnicodeReply()).

Maybe the WM_NOTIFYFORMAT message mentioned by Rick provides an easy way
around this?

Gé van Geldorp.




More information about the Ros-kernel mailing list