The Old New Thing

A single-instance program is its own denial of service

There are many ways a program can establish itself as a single-instance program; I won't go into them here. But once people head down the path of a single-instance program, they bump into another issue in their security review: Denial of service. We are using a named mutex with a fixed name in order to detect whether another copy of the ...

Why can't you programmatically reorder the items on the Start menu?

The classic Start menu and the "All Programs" portion of the Windows XP Start menu permit you to customize the order of the shortcuts that appear there. You can use drag/drop to rearrange them, or force them to be sorted by name. But why is there no programmatic interface to these actions? Because the power would be used for evil far ...

Understanding what significant digits really mean

A double-precision floating point number carries fifteen significant digits. What does this really mean? I multiplied 0.619207 by 10,000,000 and got 6192069.999999991 instead of 6192070. That's only six significant digits; where's my fifteen? Talking about significant digits is really just a shorthand for talking about relative precision. "...

Fumbling around in the dark and stumbling across the wrong solution

I don't mean to pick on this series of entries, but it illustrates an interesting pattern of stumbling across the wrong "solution". The series begins by attempting to trigger the system's monitor blank timeout by posting a message to the desktop window. As we saw earlier, the desktop window is a very special window and as a rule should be...

People are very sensitive to how the icons look

Windows XP shipped with new icons for many common items in the shell, and Windows Vista will have even more and newer icons. One of the things the designers have to be careful about with drawing these icons is to make sure they don't actually look like anything. Let me clarify. The folder icon, for example, is not based on any ...

Assaulting users with dialog box after dialog box

Increasingly, I'm seeing solving problems by adding more dialog boxes. Asking the user too much is as bad as not asking enough. "You clicked on the Notepad icon. Do you wish to run Notepad?" Okay, nobody would write a dialog box that stupid, would they? But the following dialog boxes don't really help much either: "You clicked on an mp3 ...

Raymond makes a psychic prediction for 2006

I have gazed into my crystal ball and emerged with a prediction for 2006. Revealing my prediction now may influence the event itself, so I will post only the hash for the prediction. I will post the actual prediction at the end of the year. The output of this program (after you replace "prediction goes here" with the actual prediction, of...

The first word on the command line is the program name only by convention

The format of the command line returned by is "", but this is only a convention. If you pass for the to the function, then the function will treat the first word of the as the program name. However, if you pass a value for , then that string determines the program that is run, and the string passed as the is not used for that purpose. ...

When people mimic the display rather than the actual data

I recall a bug that we were investigating that was being caused by a registry key being set when it shouldn't have been. But when you looked at the key in Regedit, it say "(value not set)". Why were we going down the "value is set" branch? A little spelunking with the debugger revealed the reason directly: Whoever set up that registry key ...