Andriy Palamarchuk wrote:
This happens in code which unmaps message, mapped
from
ASCII to Unicode. See windows/winproc.c, function WINPROC_UnmapMsg32ATo32W:
case WM_GETTEXTLENGTH: case CB_GETLBTEXTLEN: case LB_GETTEXTLEN: /* there may be one DBCS char for each
Unicode
char */ return result * 2;
What is the correct way to handle double-byte characters in this situation?
The best approach I could think of is to send an internal message from this location which returns lengths of Unicode and ASCII strings. This message will be processed only by our controls. If lengths of the Unicode strings are the same this means that both are generated by our code for the same text and I return the A length. If the lengths are different this means length was generated not in our code and I keep existing behavior (return double original Unicode length).
This method looks pretty safe and gives correct behavior in almost all cases.
Comments, suggestions? Andriy
__________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com