The Old New Thing

Why does a maximized window have the wrong window rectangle?

Commenter configurator wonders why the maximum size for a form is the screen size plus (12,12). Somebody else wonders why it's the screen size plus (16,16). Let's start by rewinding the clock to Windows 3.0. When you maximize a window, the default position of the window is such that all the resizing borders hang "off the edges of the ...

Why does my window style change when I call SetWindowText?

A customer observed some strange behavior with window styles: We ran some weird behavior: Calling the function causes a change in window styles. Specifically, calling results in the and messages, and sometimes the result is that the style is removed. Is this a bug? What would cause this? The message sends the message to the control, ...

Isn't there a race condition in GetFileVersionInfoSize?

In response to my explanation of what the parameter in is used for, Steve Nuchia wonders if there's a race condition between the time you get the size and the time you ask for the data. Yes, there is a race condition, but calling the function in a loop won't help because the function does not report that the buffer is too small to hold ...

Memory allocation functions can give you more memory than you ask for, and you are welcome to use the freebies too, but watch out for the free lunch

Memory allocation functions like , , , and all have the property that they can return more memory than you requested. For example, if you ask for 13 bytes, you may very well get a pointer to 16 bytes. The corresponding functions return the actual size of the memory block, and you are welcome to use all the memory in the block up to the ...

Why does the VerQueryValue function give me the wrong file version number?

A customer was writing a test to verify that their patching system was working properly, but they found that even after the patch was installed, a call to reported that the file was still the original version. Why was the function reporting the wrong version? Recall that the version resource is, well, a resource. And one of the things that ...

How do I get mouse messages faster than WM_MOUSEMOVE?

We saw some time ago that the rate at which you receive messages is entirely up to how fast your program calls . But what if your program is calling as fast as it can, and it's still not fast enough? You can use the function to ask the window manager, "Hey, can you tell me about the mouse messages I missed?" I can think of two cases ...

This isn't Highlights magazine: Sort keys and why they change

Some time ago, Ry Jones gave some examples of Quotable Raymond, including the following: How to make a good doc bug report: 1. Don't embed pictures. ... This isn't Highlights magazine. What Ry didn't realize is that his "..." totally misrepresented the message. There were actually two separate items, but he combined them into one ...

Instead of creating something and then trying to hide it, simply don't create it in the first place

A customer had a question, which was sort of I bet somebody got a really nice bonus for that feature in reverse. A customer is asking if there is a way to programmatically control the icons in the notification area. Specifically, they want the setting for their notification icon to be "Only show notifications" rather than "Show icon and ...