The early history of the ES_NUMBER edit control style

Raymond Chen

Raymond

The ES_NUMBER edit control style was added in Windows 95. If the style is set, then the edit control limits typed input to digits. It doesn’t do very much, but what it does is kind of handy. As noted in the documentation, this doesn’t prevent the user from putting non-digits into the edit control by other means, like pasting with Ctrl+V.

It took a while, but eventually a problem with the ES_NUMBER style was discovered: Earlier versions of Windows didn’t use this style bit, and there was an application that decided, “Hey, look, free bit!”

I don’t know what it used the bit for. Maybe it set it by mistake. But whether they set the bit on purpose or by mistake, what ended up happening was that the edit controls in this application accepted only digits!

So another application compatibility tweak was made: The ES_NUMBER style is honored only if the application’s expected Windows version is 4.0 (Windows 95) or higher.

0 comments

Comments are closed.