The Old New Thing

What is the default version of a header file?

The general rule with Windows header files is that if you don't specify which version of the header file you want, you get the latest version. For example, if you have the Windows XP Platform SDK header files and you , you're going to get the Windows XP function prototypes, the Windows XP structures, the the Windows XP ...

Why doesn't the taskbar return to its original size when I return my settings to their original values?

Commenter Gareth asked why, when the system metrics change and the taskbar changes size to match, the taskbar doesn't return to its original size when the metrics return to their previous values. Because the taskbar doesn't remember the path of changes that led to its current state. It just knows its current state. Let's say the taskbar is ...

Why can't I display a tooltip for a disabled window?

Here's a question that floated past my field of view some time ago: When the mouse hovers over a disabled window, the tooltip associated with that window does not appear. Why is this? Why isn't this documented in MSDN? Actually, you already know the answer, and it is documented. You just have to connect the dots. When a window is disabled...

Passing by address versus passing by reference, a puzzle

Commenter Mike Petry asked via the Suggestion Box: Why can you dereference a COM interface pointer and pass it to a function with a Com interface reference. The call. The function called. I found some code written like this during a code review. It is wrong but it seems to work. You already know the answer to this question. You...

Excursions in composition: Adding rewind support to a sequential stream

Here's a problem "inspired by actual events": I have a sequential stream that is the response to a request I sent to a web site. The format of the stream is rather messy; it comes with a variable-length header that describes what type of data is being returned. I want to read that header and then hand the stream to an appropriate handler. ...

Excursions in composition: Sequential stream concatenation

As we've seen a few times already (when building context menus and exploring fiber-based enumeration), composition is an important concept in object-oriented programming. Today, we're going to compose two sequential streams by concatenation. There really isn't much to it. The idea is to take two streams and start by reading from the first...

How do the menu functions find items?

Most of the menu item functions such as allow you specify the menu item either by position or by command. Some of them use the and flags. Others separate the search algorithm into a separate flag. Searching for menu items by position is straightforward: The specified position is used as a zero-based index into the menu. In other words, ...

The format of accelerator table resources

Continuing in the extremely sporadic series on the format of resources, today we'll take a look at accelerator tables. This topic is so simple, I'll cover both 16-bit and 32-bit resources on the same day! In 16-bit Windows, the format of an accelerator table resource was simply an array of structures. This array is the same array you ...