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

Why does SHGetSpecialFolderPath take such a long time before returning a network error?

A customer reported that their program was failing to start up because the call to was taking a long time and then eventually returning with . The account that was experiencing this problem had a redirected network profile, "but even if he's redirecting, why would we get the bad net path error? Does calling actually touch the folder/network? If so, we should probably stop calling this function on the UI thread since network problems could cause our program to hang." The function will access the network if you pass the flag, which says "Check if the folder is there, and if not, create it." The customer had b...

From inside the Redmond Reality Distortion Field: Why publish documents in PDF?

A few years ago, the Windows 7 team developed a document to introduce technology writers to the features of Windows 7. The document was released in PDF format, which created quite a stir among certain people trapped inside the Redmond Reality Distortion Field, who indignantly complained, Why are we releasing this document in PDF format? Shouldn't it be in docx or XPS? I would expect people interested in Windows 7 to be willing to use more Microsoft technology. Um, hello from the real world. It's the people who are critical of Windows 7 who are least likely to use Microsoft technology! "Ok...

Begin feeling

A few years ago, the gas station near Microsoft's main campus (the one which had been run by my colleague in a previous stage of his career) appeared to have suffered some problems with the LCD unit on one of its pumps. Instead of "Please insert card", it said "@leace incebd cabd". As a geek, I quickly determined that bit 4 got wiped out in the ASCII codes for the characters in the message. Undaunted, I set about going through the usual steps for purchasing gasoline, though it took a little longer than normal because I first had to decode the corrupted strings. And then after I thought I had finished all the ne...

2010 year-end link clearance

Another round of the semi-annual link clearance. And, as always, the obligatory plug for my column in TechNet Magazine:

What makes RealGetWindowClass so much more real than GetClassName?

There's and then there's . What makes more real? Recall from last time that the functions were added to support Windows accessibility. The goal with is to help accessibility tools identify what kind of window it is working with, even if the application did a little disguising in the form of superclassing. If you ask for the class name of a window, it digs through all the superclassing and returns the name of the base class (if the base class is one of the standard window manager classes). For example, if your application superclassed the class, a call to would return , but a call to would return . ...

WindowFromPoint, ChildWindowFromPoint, RealChildWindowFromPoint, when will it all end?

Oh wait, there's also . There are many ways of identifying the window that appears beneath a point. The documentation for each one describes how they work, but I figured I'd do a little compare/contrast to help you decide which one you want for your particular programming problem. The oldest functions are and . The primary difference between them is that returns the deepest window beneath the point, whereas returns the shallowest. What do I mean by deep and shallow? Suppose you have a top-level window P and a child window C. And suppose you ask one of the above functions, "What window is beneath ...

Psychic debugging: When I copy a file to the clipboard and then paste it, I get an old version of the file

A customer reported the following strange problem: I tried to copy some text files from my computer to another computer on the network. After the copy completes, I looked at the network directory and found that while it did contain files with the same names as the ones I copied, they have completely wrong timestamps. Curious, I opened up the files and noticed that they don't even match the files I copied! Instead, they have yesterday's version of the files, not incorporating the changes that I made today. I still have both the source and destination folders open on my screen and can confirm that the files I cop...

Windows 7 not only can make a wallpaper slide show from images on your computer, it can even pull them from an RSS feed

Buried in the theme file documentation is a section called [Slideshow] which lets you control the source for images that are used when you put the desktop wallpaper in slideshow mode. And a bonus feature hidden in the [Slideshow] section is the ability to draw the images from an RSS feed. After creating the .theme file, double-click it and it will be added to the list of available themes. One thing about the RSS feed is that when you first set it up, it'll probably take a while for the initial images to download. You don't get any feedback that the images are still downloading; they just show up once they're re...

Why can’t you use the space bar to select check box and radio button elements from a menu?

Because it's a menu, not a dialog box.