The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts

Misleading advertisement: Passports or green cards?

I happened to spot an online advertisement for a company that will help you enter the lottery for a United States Permanent Resident Card, commonly known as a Green Card (even though they card isn't green any more). The advertisement was illustrated with a picture of a United States passport. Um, a Green Card is not the same as a passport, nor does a Green Card authorize you to obtain a passport. Passports are for citizens, not alien permanent residents.

Creating context menus on menus

Last week we looked at menu drag/drop. Another little-used menu feature added in Windows 2000 is the ability to show context menus on menus. The message is and the flag is . Let's demonstrate with a simple program. Start with the scratch program, and add the function just so our context menu can do something. When we receive the message and confirm that the menu is the one we support, we create the popup menu and display it at the mouse location (obtained via ) with the flag, indicating that this is a pop-up menu for a pop-up menu. (We also use , but that's nothing new.) If the user chose to mov...

The new business model: Intentional billing errors

Just in the last month, I had to call a bank to reverse four erroneous "Account Maintenance Fees" across two different accounts. It appears that intentional billing errors is the new business model for our struggling economy. (For the record, although I am responsible for maintaining these accounts, I did not open the accounts at the bank in question. My personal account is at a credit union.) One of my friends remarked, "I got only two. They must not really be trying yet." Many years ago, back when the dot-com bubble appeared unpoppable, a different friend of mine happened to meet somebody who sheepishly admi...

Why don't ZIP files have the FILE_ATTRIBUTE_COMPRESSED attribute?

A customer reported that when they called on a ZIP file, the attribute was not returned. But ZIP files are compressed. Why isn't the attribute being set? Because tells you whether the file was compressed by the file system. It is not a flag which describes the semantics of the bytes stored in the file. After all, the file system doesn't know that this particular collection of bytes is a ZIP file and contains data that was compressed externally. Who knows, maybe it's just some uncompressed file that just happens to look superficially like a ZIP file (but isn't)? If a text file consists of the string "ADTUR ...

Exploiting the inattentive: The Xbox Kinect Premium Starter Kit

The name of the product is the Xbox Kinect™ Premium Starter Kit. The promotional images and box images show an Xbox Kinect device. But if you look closely, you'll see that the Xbox Kinect™ Premium Starter Kit does not come with an Xbox Kinect.

Why wasn't the Windows 95 shell prototyped on Windows NT?

Carlos wonders why the Windows 95 shell was prototyped as 16-bit code running on the still-under-development 32-bit kernel, USER, and GDI as opposed to being prototyped as fully 32-bit code on Windows NT. There were a number of reasons, some good, some bad. One reason was that the Windows 95 shell was being developed by the Windows 95 team, which was an outgrowth of the Windows 3.1 team. That meant that they had Windows 3.1-class hardware. And the hardware requirements of Windows NT were significantly higher than the hardware requirements of Windows 3.1. Here's a table for compari...


Using the MNS_DRAGDROP style: Menu rearrangement

In order to do drag-drop rearrangement of menus, you need four things, most of which we already know how to do. Dragging an item out of a menu. Check. Dropping an item into a menu. Check. Connecting the drag with the drop. Rearranging menu items in response to the operation. Let's do step 4 first, just to mix things up. And since this is just a demonstration rather than production code, I'm only going to support string menu items of up to 255 characters in length. One thing you might not have noticed is that I inserted the copy before deleting the original. That way, we don't get st...

Using the MNS_DRAGDROP style: Dropping in

Last time, we looked at using the style for dragging items out of a menu. Today, we'll look at dropping them in. Take the program from last time and make the following additions. First, let's add a second item to the menu. Yes, I hard-coded another path. This is a demo, not production code. Anyway, it's time to hook up the message: To handle the message, you convert the , pair into a COM object, requesting the interface provided by the member, and putting the result into the member. (Exercise: Why is the member typed as rather than ?) When the user tries to drop on a menu item, we just give ...