February 20th, 2019

The early history of the ES_NUMBER edit control style

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.

Topics
History

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.