How does CEdit determine its internal behavior from the containing application? Is it at creation time, in which case IsWindowUnicode returning false would suggest it should return position in BYTES not wchar_t
as I understand it.
I am maintaining a large legacy application build using MBCS. On a system with Japanese as the system locale I have an issue where the selection position of an edit control is being returned incorrectly.
Code Snippet
- CEdit* pEdit = state->GetEdit() ;
- auto hWnd = pEdit->GetSafeHwnd() ;
- if ( hWnd )
- {
- ::SendMessageA(hWnd, EM_GETSEL, (WPARAM)&nStart, (LPARAM)&nEnd) ;
- TCHAR buffer[128];
- ::SendMessageA(hWnd, WM_GETTEXT, (WPARAM)_countof(buffer), (LPARAM)&buffer);
With the Carat at the end of the string this produces the output
String '未定義' selection [3,3], unicode? False
What on earth can be going on?
I have built a little test application and that works as I would expect producing the output
String '未定義' selection [6,6], unicode? False