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

Some remarks on VirtualAlloc and MEM_LARGE_PAGES

Large pages are a special feature for dedicated server processes.

How do you obtain the icon for a shortcut without the shortcut overlay?

The easy one-stop-shopping way to get the icon for a file is to use the function with the flag. One quirk of the function is that if you pass the path to a shortcut file, it will always place the shortcut overlay on the icon, regardless of whether you passed the flag. (Exercise: What is so special about the shortcut overlay that makes it exempt from the powers of the flag? The information you need is on the MSDN page for , though you'll have to apply some logic to the sitaution.) I'm using SHGetFileInfo to get the icon of a file to display in my application. When the file is a shortcut, rather t...

Microspeak: Leverage

At Microsoft, leverage is not a term of physics whereby a force can be magnified by the application of mechanical advantage. It is also not a term of finance whereby the power of a small amount of money can be magnified by the assumption of debt. In fact, at Microsoft, the word leverage isn't even a noun. It is a verb: to leverage, leverages, leveraging, leveraged, has leveraged. Oh, and it has nothing to do with magnification. Here are some citations: How do I leverage a SiteMap? Allow advertising partners to leverage this resource for providing targeted advertising links. Leverage existing design to power...

Why does the name of my TEMP directory keep changing?

A customer liaison contacted the shell team with the following request: Subject: Support case: 069314718055994 On two of my customer's machines, he's finding that if he opens %TEMP% from the Start menu, it opens C:\Users\username\AppData\Local\Temp\1, C:\Users\username\AppData\Local\Temp\2, and so on. Each time the user logs off and back on, the number increments. The number resets after each reboot. Why are we seeing these folders being created under Temp? This does not appear to be the default behavior. What would cause the operating system to create these folders? The customer rebuilt one of the affected m...

There's a default implementation for WM_SETREDRAW, but you might be able to do better

If your window doesn't have a handler for the message, then will give you a default implementation which suppresses messages for your window when redraw is disabled, and re-enables (and triggers a full repaint) when redraw is re-enabled. (This is internally accomplished by making the window pseudo-invisible, but that's an implementation detail you shouldn't be concerned with.) Although the default implementation works fine for simple controls, more complex controls can do better, and in fact they should do better, because that's sort of the point of . The intended use for disabling redraw on a window is in...

The 2011/2012 Seattle Symphony subscription season at a glance

Every year, I put together a little pocket guide to the Seattle Symphony subscription season for my symphony friends to help them decide which ticket package they want. As before, you might find it helpful, you might not, but either way, you're going to have to suffer through it. Here's the at-a-glance season guide for the first season with newly-appointed music director Ludovic Morlot. (Full brochure [pdf].) function filter(c) { var rows = document.getElementById("schedule").getElementsByTagName("TR"); for (var i = 0; i != rows.length; i++) { var row = rows[i]; var className = row.className; if (c...

Modality, part 9: Setting the correct owner for modal UI, practical exam

Here's a question that came from a customer. You can answer it yourself based on what you know about modal UI. (If you're kind of rusty on the topic, you can catch up here.) I've left in some irrelevant details just to make things interesting. Our program launches a helper program to display an Aero Wizard to guide the user through submitting a service request. There are no calls leading up to or returning from this call. the handles things nicely. When the user clicks "Cancel" to cancel the service request, we use a TaskDialog so we can get the new look for our confirmation message box. The task dial...

How to turn off the exception handler that COM "helpfully" wraps around your server

Historically, COM placed a giant around your server's methods. If your server encountered what would normally be an unhandled exception, the giant would catch it and turn it into the error . It then marked the exception as handled, so that the server remained running, thereby "improving robustness by keeping the server running even when it encountered a problem." Mind you, this was actually a disservice. The fact that an unhandled exception occurred means that the server was in an unexpected state. By catching the exception and saying, "Don't worry, it's all good," you end up leaving a corrupted server run...

Why didn’t they use the Space Shuttle to rescue the Apollo 13 astronauts?

Understanding decisions in the context of history.