GetWindowText() issue



Hi all,

Standard ANSI C Win32 application - no Unicode anywhere.
I want to retrieve the first 7 bytes of the current value of a
Combobox field on a window (all owned).
All values in the Combo Dropdown list are approx 20 bytes
in length.

So the code essentially is

TCHAR Buffer[8];

rc = GetWindowText(hWndCombo, Buffer, sizeof(Buffer));

Under Win9x:
rc = 8 (although it should be 7 according to the documentation as it should
not include the NULL character).

Under Windows XP SP2
rc = 16 and more importantly it is over-running the buffer.

I have tried calling GetWindowTextA() and I have also tried SendMessage(...,
WM_GETTEXT...) but under Windows XP it is ignoring the buffer size parameter
altogether.

I have confirmed that sizeof(Buffer) is correct, and I have even confirmed
sizeof(TCHAR) is 1 byte.

Can anyone reproduce this problem as it is frustrating the hell out of me.
Leslie.



.