Showing tag results for Code

Apr 11, 2007
Post comments count0
Post likes count1

What's the difference between WINVER, _WIN32_WINNT, _WIN32_WINDOWS, and _WIN32_IE?

Raymond Chen

Okay, so there are all these different ways you can specify what version of the Windows header files you want.† Let's take them in order. The symbol is the earliest one. That's the symbol that 16-bit Windows used to control the versioning of its header files, and its use carried forward into the 32-bit header files, presumably from t...

Code
Apr 10, 2007
Post comments count0
Post likes count1

What is the default version of a header file?

Raymond Chen

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 flags, a...

Code
Apr 9, 2007
Post comments count0
Post likes count1

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

Raymond Chen

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 30 pi...

Code
Apr 5, 2007
Post comments count0
Post likes count1

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

Raymond Chen

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, it d...

Code
Mar 29, 2007
Post comments count0
Post likes count1

The buffer size parameter to GetFileVersionInfo is the size of your buffer, no really

Raymond Chen

The function takes a pointer to a buffer () and a size (), and that size is the size of the buffer, in bytes. No really, that's what it is. The application compatibility folks found one popular game which wasn't quite sure what that parameter meant. The programmers must have thought it meant "The size of the version resources you want to loa...

Code
Mar 26, 2007
Post comments count0
Post likes count1

Passing by address versus passing by reference, a puzzle

Raymond Chen

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 mere...

Code
Mar 23, 2007
Post comments count0
Post likes count1

Excursions in composition: Adding rewind support to a sequential stream

Raymond Chen

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. But t...

Code
Mar 22, 2007
Post comments count0
Post likes count1

Excursions in composition: Sequential stream concatenation

Raymond Chen

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 one....

Code
Mar 19, 2007
Post comments count0
Post likes count1

How do the menu functions find items?

Raymond Chen

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 fir...

Code