The evolution of window and class extra bytes in Windows
The article traces the evolution of window and class extra bytes in Windows, explaining how these fields have changed from 16-bit Windows through 32-bit and 64-bit versions, including limitations and compatibility considerations.
Background
- The article discusses **window extra bytes** and **class extra bytes**, two old but still-supported Windows mechanisms that let developers attach custom data to a window or window class without creating a separate data structure.
- **Raymond Chen** is a veteran Microsoft developer who writes "The Old New Thing" blog, a long-running deep-dive into Windows internals and history.
- The post traces how these APIs evolved from 16-bit Windows (Windows 1.0/2.0 in the mid-1980s) through Win32 (Windows NT/95 onward) to modern 64-bit Windows.
- Key tension: early Windows (16-bit) had severe memory constraints, so baking per-window storage into the window manager itself was a pragmatic shortcut. Over time, as memory became abundant and object-oriented programming took over, the mechanism became an awkward relic that coexists with modern approaches (like using `SetWindowLongPtr`/`GWLP_USERDATA` or C++ class wrappers).
- Knowing this background helps make sense of why Windows still carries quirky, limited-size private storage on window objects — and why newer code should avoid it.