superclassing and unicode <-> ansi conversion

superclassing and unicode <-> ansi conversion

Post by qfel » Fri, 01 Jun 2007 04:39:03


When subclassing, GetWindowLongPtr returns possibly flagged value, so
CallWndProc knows whether to do ansi<->unicode conversion. But, when
superclassing whith GetClassInfo[Ex], lpfnWndProc member is always pure
pointer, so CallWndProc won't work properly. Is there any good way to get
messages translated if original window proc was unicode and my new one is
ansi (besides undocummented stuff like flagging original wndproc pointer)?
 
 
 

superclassing and unicode <-> ansi conversion

Post by David Lieb » Fri, 01 Jun 2007 05:47:04

I do this:

if(IsWindowUnicode(hwnd)) return
CallWindowProcW((WNDPROC)WindowProc,hwnd,msg,wParam,lParam) ;
else return CallWindowProcA((WNDPROC)WindowProc,hwnd,msg,wParam,lParam) ;

David Liebtag

 
 
 

superclassing and unicode <-> ansi conversion

Post by Mihai N » Fri, 01 Jun 2007 17:06:58

> When subclassing, GetWindowLongPtr returns possibly flagged value, so

Windows looks at your window (IsWindowUnicode) and does the conversion
if the answer is no. When you WndProc get the control, the conversion
is already done.
It does not care if you treat the message yourself or you pass it so
some other WndPrec.

So I would say there is no way (except for making your window Unicode)



--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.yqcomputer.com/
------------------------------------------
Replace _year_ with _ to get the real email