The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
The introduction of whimsical teasing in Comic Chat
A few months after my post on the sad demise of whimsical teasing in Comic Chat, I received a piece of email from none other than the author of Comic Chat, DJ Kurlander: I was the person that started the Comic Chat project in Microsoft Research and was responsible for that line, "This person is too lazy to create a profile entry." Not a whole lot of thought went into the default profile. In maybe the 30 seconds that I put into it, I thought that the line was moderately humorous, fit with the quirky nature of Comic Chat, and might motivate more people to create profiles. When we released version 2, MSN got th...
2011 Q1 link clearance: Microsoft blogger edition
It's that time again: Linking to other Microsoft bloggers.
Having an owner window from another process is tricky, but it's sometimes the right thing to do
A customer had a main program (let's call it A) and a helper program (let's call it B), and the customer wanted and wanted B to act like a modal dialog relative to A. When B is launched, we disable A's window and then call to simulate a modal dialog. How do we make sure that focus goes to B's window and not A's? We've found that if the user clicks on the (now-disabled) window from the process A, then window B loses focus. This is not the behavior from regular modal windows however: For normal modal windows, clicking on the disabled owner activates the modal popup. One idea is to watch for...
How do I get the title of a dialog from a dialog resource?
A customer submitted the following question: We are developing automated tests for our application. Among other things, our application uses property sheets, which means that the name of the tab is stored as the title of the dialog template resource. Since we want our automated tests to run on all language versions of our application, we don't want to hard-code the tab names in our automated test. I have not been able to find any information on how to programmatically extract the dialog titles from the dialog resources. Any pointers would be appreciated. I replied with some pointers: The customer was gratef...
Although the default icon for a shortcut is the icon of the target, you can override that
A customer reported that a shortcut they deployed to their employees' desktops was triggering unwanted server traffic. My customer deploys a shortcut on %ALLUSERSPROFILE%\Desktop, and this shortcut points to an EXE file on a remote server. Once a local user logs on, the computer will try logging onto the remote computer to query information and generate a login failure alert on the server. Is there any way to stop Explorer from querying the shortcut information? Fortunately, the customer provided context for the question, because the question the customer is asking doesn't actually match the scenario. The ...
Why did Win32 define BOOL as a signed int instead of an unsigned int?
Igor Levicki wants somebody from Microsoft to explain why was defined as a instead of an . You don't need to work for Microsoft to figure this out. All the information you need is publically available. Quoting from K&R Classic, which was the operative C standards document at the time Windows was being developed: 7.6 Relational Operators The [relational operators] all yield 0 if the specified relation is false and 1 if it is true. The type of the result is . Win32 defined as synonymous with because Brian and Dennis said so. If you want to know why Brian and Dennis decided to have the result of rel...
Paul Cézanne and Camille Saint-Saëns may have similar-sounding last names, but they are not the same person
Next week, the Seattle Symphony Orchestra performs the Saint-Saëns Organ Symphony, but the people responsible for the symphony's radio advertisements don't realize that. As the strains of the symphony resound in the background, the announcer proudly announces that tickets are still available for "Cézanne's Organ Symphony." The names Cézanne and Saint-Saëns may sound similar, but I can assure you that they are not the same person. Here's a handy chart: This is not the first time the Seattle Symphony's radio announcer has made this substitution. I don't know whether somebody is giving h...
How do I monitor, or even control, the lifetime of an Explorer window?
A customer wanted help with monitoring the lifetime of an Explorer window. We want to launch a copy of Explorer to open a specific folder, then wait until the user closes the folder before continuing. We tried launching a copy of Explorer with the folder on the command line, then doing a on the process handle, but the wait sometimes completes immediately without waiting. How do we wait until the user closes the Explorer window? This is another case of solving a problem halfway and then having trouble with the other half. The reason that returns immediately is that Explorer is a single-instance program (w...
How can I generate a consistent but unique value that can coexist with GUIDs?
A customer needed to generate a GUID for each instance of a hardware device they encounter: The serial number for each device is 20 bits long (four and a half bytes). We need to generate a GUID based on each device, subject to the constraints that when a device is reinserted, we generate the same GUID for it, that no two devices generate the same GUID, and that the GUIDs we generate not collide with GUIDs generated by other means. One of our engineers suggested just running and substituting the serial number for the final nine hex digits. Is this a viable technique? This is similar to the trap of thinking tha...