The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Crazy ideas at the lunch table: The ice cream bicycle
Jul 11, 2008
Post comments count 0
Post likes count 0

Crazy ideas at the lunch table: The ice cream bicycle

Raymond Chen
Raymond Chen

At the lunch table some time ago, we considered the possibility of riding the STP atop a classic ice cream bicycle. You could play the music and cruise down the road, selling ice cream sandwiches out of your trunk. Naturally, you'd start really early in the day, because you can't go very fast on that bicycle, and besides, nobody is going to want ice cream early in the morning, so you may as well get a head start on them. Ideally, they would catch up to you around mid-afternoon, during the hot part of the day when they're looking for a break. No idea how practical this is, it was just a crazy idea. (App...

The evolution of menu templates: 32-bit classic menus
Jul 11, 2008
Post comments count 0
Post likes count 0

The evolution of menu templates: 32-bit classic menus

Raymond Chen
Raymond Chen

Now that we've got a handle on 16-bit classic menu templates, we can move on to the next evolutionary step, namely 32-bit classic menu templates. The 32-bit classic menu template is in fact nearly identical to the 16-bit classic menu template. The only change is that the menu text is now a Unicode string instead of an ANSI string. Consequently, the discussion below will be rather brief when there is nothing new being introduced. The 32-bit classic menu template begins with the same header, and the fields have the same meaning. struct MENUHEADER32 { WORD wVersion; WORD cbHeaderSize; BYTE rgbExtra[cbHead...

News flash: Car salesmen are sneaky and underhanded
Jul 10, 2008
Post comments count 0
Post likes count 0

News flash: Car salesmen are sneaky and underhanded

Raymond Chen
Raymond Chen

Steve Tripoli looks at deception in the car sales industry.

What’s the deal with that alternate form for menu item template separators?
Jul 10, 2008
Post comments count 0
Post likes count 0

What’s the deal with that alternate form for menu item template separators?

Raymond Chen
Raymond Chen

We saw last time that you can specify a separator in a menu item template by specifying zero for everything, even though technically you're supposed to pass MFT_SEPARATOR for the flags. What's the deal with that alternate form for menu item template separators? This goes back to the early days of the InsertMenu function (and its friends like AppendMenu and ModifyMenu). In the Before Time, the way you specified a separator was to add a null pointer. Not a null string (a string with no characters, consisting only of the null terminator), but an actual null pointer. AppendMenu(hmenu, MF_STRING, 0, NULL); Th...

Warning: This cereal may contain traces of spiders
Jul 9, 2008
Post comments count 0
Post likes count 0

Warning: This cereal may contain traces of spiders

Raymond Chen
Raymond Chen

In a Lisbon grocery store, I was looking at the ingredient panel of a box of cereal. It contained the information in multiple languages, and French came first. I was momentarily stunned by the following warning: Traces possibles d'arachides. I guess this falls in the category of "Raymond misreads French cereal box warnings."

The evolution of menu templates: 16-bit classic menus
Jul 9, 2008
Post comments count 0
Post likes count 0

The evolution of menu templates: 16-bit classic menus

Raymond Chen
Raymond Chen

Menus aren't as complicated as dialogs. There are no fonts, no positioning, it's just a list of menu items and flags. Well, okay, there's the recursive part, when a menu has a submenu. But that's really the only wrinkle. Most of it is pretty boring. The 16-bit classic menu template begins with the following header: struct MENUHEADER16 { WORD wVersion; WORD cbHeaderSize; BYTE rgbExtra[cbHeaderSize]; }; The version is zero for 16-bit classic menu templates, and the cbHeaderSize is the number of extra bytes in the menu header that have to be skipped over to find the first actual menu item. In practice, cbH...

Wikipedia has created its own reactionary subculture
Jul 8, 2008
Post comments count 0
Post likes count 0

Wikipedia has created its own reactionary subculture

Raymond Chen
Raymond Chen

Now that Wikipedia has catapulted the wiki into the general consciousness, where there's a wiki, a spoof of a wiki can't be far behind.

The evolution of menu templates: Introduction
Jul 8, 2008
Post comments count 0
Post likes count 0

The evolution of menu templates: Introduction

Raymond Chen
Raymond Chen

As with dialog templates, menu templates have also gone through a four-stage evolutionary process. People don't often generate menu templates in code, although the function is there waiting for you once you get the urge. As a result, there aren't many questions from people trying to generate menu templates dynamically, but I'm going to go into the history of menu templates anyway, just out of a sense of completeness. If you're having problems with your dynamically-generated menu templates, you can ask the resource compiler to tell you what you're doing wrong by createing a *.rc file for it and compiling it in...

Why is the LOADPARMS32 structure so messed up?
Jul 7, 2008
Post comments count 0
Post likes count 0

Why is the LOADPARMS32 structure so messed up?

Raymond Chen
Raymond Chen

If you look at the LOADPARMS32 structure, you'll find a horrific mishmash. Double-null-terminated strings, a null-terminated string, some WORDs, and even a Pascal-style string. What's going on here? Each of those members comes from a different era in time. The oldest member is the Pascal-style command line, which dates back to CP/M. On CP/M, command lines were stored at a fixed location, namely 0080h through 00FFh, in the form of a Pascal string. The byte at 0080h specified the length of the command line, and the bytes at 0081h through 00FFh contained the command line itself. MS-DOS based much of its initia...