winapivb6editcontrolcreatewindowex

ES_NUMBER, ES_UPPERCASE and ES_LOWERCASE styles stopped working for Win32 API edit control


We have a very old ("legacy") VB6 code used to create the Windows edit control from scratch. It looks like this:

Dim dwStyle As Long
dwStyle = WS_CHILD Or ES_AUTOVSCROLL Or ES_AUTOHSCROLL Or ES_NUMBER Or ES_MULTILINE

m_hwndEdit = CreateWindowExW(0, StrPtr("Edit"), 0, dwStyle, plX, plY, plWidth, plHeight, m_hWnd, 0&, App.hInstance, ByVal 0&)

It has worked for years, but now customers report that the ES_NUMBER style has no effect. The same concerns two similar flags, ES_UPPERCASE and ES_LOWERCASE. What can be the problem?


Solution

  • Nothing has changed. Those styles work just as well today as they have always done. Some possible explanations:

    1. Some other program is modifying the window style of your edit control.
    2. Some other program is automating your application and setting the text of the control programmatically. For instance, an on-screen keyboard.
    3. Your users are pasting values into the edit control rather than typing them.

    I suggest that you contact your users and ask them to describe precisely how they are putting these values into the control.