The Old New Thing

My life as a square (pixel)

The shape of the Windows screen pixel has changed over the years. It has always had a rectangular shape, but the ratio of height to width has varied. (Someday, somebody will come up with a display adapter with hexagonal or triangular pixels, and then everything will fall apart.) Our story begins with the Color Graphics Adapter, better known ...

Annotating function parameters and using PREfast to check them

Via the suggestion box, Sys64738 asks, whether I think is a good C/C++ programming style to add IN and OUT to function prototypes. Remember, this is my opinion. Your opinion may validly differ. I would go beyond just IN and OUT and step up to SAL annotations, which describe the semantics of function parameters in more detail than simply IN...

How do I indicate that I want my window to follow right-to-left layout rules?

There are many ways, depending on how wide a scope you want. If there is one specific window that you want to follow right-to-left layout rules, then you pass the extended window style when you create the window. This extended style is inherited by child windows, so once you set a top-level window to have right-to-left layout, all child ...

Why doesn't the Windows Vista copy progress dialog show the names of the files being copied?, redux

As expected, everybody concluded that the Windows Vista copy progress dialog made every wrong decision possible. Let's look at some of the suggestions on making it suck less: Why not update the file name every five seconds to the file that is being copied at that time? Sure, you could do that, but the cost of getting the name is part of the...

How do I accept files to be opened via IDropTarget instead of on the command line? – bonus content

One of my colleagues tipped me off to some additional resources on the subject of using the DropTarget technique for accepting files for execution. First, it turns out that there is an SDK sample that demonstrates the DropTarget technique after all. This sample is fifteen years late according to one commenter who apparently thinks that the...

Every window with the WS_SYSMENU style has a system menu, but it's not there until it needs to be

I mentioned last time that there's an optimization in the treatment of the system menu which significantly reduces the number of menus in the system. When a window has the window style, it has a system menu, but until somebody calls on that window, nobody knows what its menu handle is. Until that point, the window manager doesn't actually ...

How do I find the bounding box for a character in a font?

A customer had the following question: I'm looking for a way to get the height of text which consists entirely of digits, for example , as these characters do not have any descent or internal leading. I expected functions like to return the character's ascent minus the internal leading, but in fact it returns the ascent plus the descent ...

SHAutoComplete giveth, and SHAutoComplete taketh away

The function lets you attach autocomplete functionality to an edit control, and there are flags that describe what sources you want the autocomplete to draw from. If you call a second time, the second set of flags replace the original flags. The flags do not accumulate. For example, if you first call , and then you later call , the result ...