The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
Why does RegOpenKey sometimes (but not always) fail if I use two backslashes instead of one?
A customer reported that on Windows XP, they observed that their program would very rarely get the error when they passed two backslashes instead of one to the function: After removing C++ escapes, the resulting string passed to is The failure was very sporadic and not reproducible under controlled conditions. Well, first of all, doubled backslashes are not legal in registry key paths in the first place, so the first recommendation is stop doubling the backslashes. Once you fix that, the problem will go away. But the next question is why the error was detected sometimes but not always. When a...
How do I suppress the default animation that occurs when I hide or show a window?
A customer wanted to know how they can disable the default fade-in/fade-out animation that occurs when a window is hidden or shown. "I don't want to use because that causes my window to disappear from the taskbar. I tried but that affects the entire desktop and is too jarring. We want to suppress the effect because our program replaces one window with another, and we want the operation to be invisible to the user." Whoa, heading straight for ? That's using a global solution to a local problem. To disable the animations on a specific window, use something like this: Re-enabling the animations is left as ...
Microspeak: Granular
Today's Microspeak word is granular. Here are some citations. Please bring your cost estimates at the granularity of 3, 5 or 10 days. The archive function archives all data older than the date specified. Is there a way to get the archive to be more granular than just a date? Our database covers multiple accounts, and we'd like to choose a different date for each account. There are about 2000 warnings to be investigated. I've assigned them at component granularity. Granularity is roughly equivalent to level of detail or unit of separation. In the first example, the cost estimates should be broken down int...
What's the difference between F5 and F8 at the boot screen?
Ian B wondered what the difference is between pressing F5 and F8 while Windows is booting. I have no idea either. My strategy was to just mash on the function keys, space bar, DEL key, anything else I can think of. Keep pressing them all through the boot process, and maybe a boot menu will show up. The F5 hotkey was introduced in Windows 95, where the boot sequence hotkeys were as follows: Man, that's an insane number of boot options all buried behind obscure function keys. Boy am I glad we got rid of them. This frees up room in my brain for things like Beanie Baby trivia. Bonus chatter: The next gen...
2012 Q3 link clearance: Microsoft research edition
My Q1 and Q3 link clearances are traditionally for links to other Microsoft bloggers, but this time I'm going to link to a few Microsoft research papers I found interesting. Why do Nigerian scammers say they're from Nigeria? Short answer: Because it ensures that the replies come only from the most gullible people on earth. Bonus chatter: I received a scam email purportedly from Sir Humphrey Appleby, secretary to the Prime Minister. I could tell it was a fake because the message was comprehensible. Sketch2Cartoon: Composing Cartoon Images by Sketching Okay, I admit I haven't read the paper. But ...
Data in crash dumps are not a matter of opinion
A customer reported a problem with the function. (Gosh, why couldn't they have reported a problem with a function with a shorter name! Now I have to type that thing over and over again.) We're having a problem with the function. We call it like this: On some but not all of our machines, our program crashes with the following call stack: This problem appears to occur only with the release build; the debug build does not have this problem. Any ideas? Notice that in the line of code the customer provided, they are not calling ; they are instead calling some application-defined method with the same nam...
The Ride to Rio: Bicycling from Los Angeles to Rio de Janeiro
An acquaintance of mine remarked that he sold his bicycle in Seattle a few months ago to some guy who explained, "I'm going to ride it to South America." "Okay," my acquaintance said, probably with some degree of skepticism. But it's a real project, and they head out soon! Ride to Rio: Four riders who "share a thirst for being stupid and finding adventure" bicycling through twelve countries and finishing in Rio with very sore butts.
Why aren't environment variables being expanded in my RGS file?
A customer was having trouble with their RGS file. I want to include the below line in a .rgs file: When I do this, registering of the dll fails with 80002009. Any help? If I change it to then the registration succeeds (but of course now contains a hard-coded path). A common problem people have when asking a question is assuming that the person reading your question has knowledge that is a strict superset of what you know. As a result, people omit details like the answer to the question "How did you register your RGS file?" If all else fails read the documentation (which happens to be the #1 hit for...
Sabotaging yourself: Closing a handle and then using it
A customer reported a problem with the function: I have a DLL with an function and an function. The code goes like this: Under certain conditions, the function is called twice, and the function is correspondingly called twice. Under these conditions, if I run the code on a single-processor system with hyperthreading disabled, then everything works fine. But if I enable hypethreading, then the second call to hangs in the call. (As you can see, it's waiting for a mutex handle which was closed by the previous call to .) Why does this happen only on a hyperthreaded machine? Shouldn't the return beca...