Search code examples
c++winapiedit-controlmixed-case

Win32 Edit control mixed case


I'm learning and new to this. I've searched this for a long time and can't find any answer.

Every time I type text in an Edit control, it always turned to lowercase, even when using Shift or CapsLock. I did not put any lowercase/uppercase style on it:

hEditSub = CreateWindow("EDIT", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | EM_SETHANDLE, 10, 334, 270, 20, hwnd_MainSub, NULL, hInstance_Main, NULL);

Is there any way to make it mixed case (allowing lower and uppercase)? Or is subclassing required?


Solution

  • EM_SETHANDLE is a window message constant and not a window style. Presumably it has numeric value that causes the behaviour. One imagines that your bogus style is being interpreted as ES_LOWERCASE.

    Remove EM_SETHANDLE from your window style.