Hi,
Does Windows XP use Unicode controls too if theming is on?
Because the Delphi edit controls are now in Unicode mode, the messages sent to them have to be translated from ANSI to Unicode and back. When a program reads the "Text" property of a TEdit control, Delphi sends a WM_GETTEXTLENGTH message. Wine doubles the return value when translating back from Unicode to ANSI because of double-byte character sets. (dlls/user/winproc.c)
Windows (2k+ at least) in this case actually also sends a Unicode WM_GETTEXT in this case and determines the true ANSI length from the Unicode string. Wine should (IMO) be fixed to do the same.
I can confirm this. Windows 2000 does not truncate any text or return doubled text lengths (even if it could according to the MSDN docs). We need to improve Wine's automatic message translation a lot! Some examples of A->W message translations:
WM_GETTEXTLENGTH: Windows sends WM_GETTEXTLENGTH and WM_GETTEXT LB_GETTEXTLEN: LB_GETTEXTLEN, LB_GETTEXT CB_GETLBTEXTLEN: CB_GETLBTEXTLEN, CB_GETLBTEXT LB_GETTEXT: LB_GETTEXTLEN, LB_GETTEXT, LB_GETTEXT CB_GETLBTEXT: CB_GETLBTEXTLEN, CB_GETLBTEXT, CB_GETLBTEXT
Try this patch: http://www.winehq.org/pipermail/wine-patches/2005-August/020285.html Unfortunately, it is as-is not CVS-worthy...
I think you could use SendMessageW instead of calling the window proc directly. But apart from that, why is the patch not CVS-worthy?
Regards Michael