The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Aug 27, 2012
Post comments count 0
Post likes count 1

How does the taskbar decide whether to show Recent or Frequent documents on the jump list?

Raymond Chen

Some jump lists show Recent documents, and others show Frequent documents. (Images stolen from Sasha Goldshtein.) Our friend xpclient wanted to know how the taskbar decides which one to use, because it seemed random. (Ironically, xpclient is asking a question about the Window 7 client.) The default is to show Recent documents. But an application can customize its jump list, and in that case, the application can select which category to show based on the guidance in the documentation. (Or the application might choose to ignore the guidance in the documentation and show both.) Okay, but what about Expl...

Aug 24, 2012
Post comments count 0
Post likes count 1

Dumping a hash table with external chaining from the debugger

Raymond Chen

I was doing some crash dump debugging, as I am often called upon to do, and one of the data structure I had to grovel through was something that operated basically like an atom table, so that's what I'll call it. Like an atom table, it manages a collection of strings. You can add a string to the table (getting a unique value back, which we will call an atom), and later you can hand it the atom and it will give you the string back. It looked something like this: (It didn't actually look like this; I've reduced it to the smallest example that still illustrates my point.) As part of my debugging, I had an atom...

Aug 23, 2012
Post comments count 0
Post likes count 1

Wait, you never said that I had to initialize the object before I used it!

Raymond Chen

A customer reported that they were having trouble creating slim reader/writer locks at runtime. They simplified the issue to a short program: "What is the correct way of creating an via the operator?" It wasn't long before somebody noted that nowhere in the code is the function called. "Oh, yeah, thanks for catching that. It looks like one needs to initialize SRW locks which are created via the operator. Otherwise it's not required." No, the function is always required. It's just that you got lucky in the local variable case and the initial stack garbage looks enough like an initialized SRW lock th...

Aug 22, 2012
Post comments count 0
Post likes count 1

The shifting sands of "Run as different user"

Raymond Chen

A customer liaison asked the following question on behalf of his customer. When I do a shift-right-click on a shortcut to a program, I see the following: The option to run a program as another user (other than Administrator) was present in Windows XP, but it was lost in Windows Vista. It appears that we responded to those complaints by restoring the functionality in Windows 7. Is that right? The odd thing is that my customer has the Run as different user option available on their Windows 7 machines, but not on their Windows Server 2008 R2 machines. Does whether you have access t...

Aug 21, 2012
Post comments count 0
Post likes count 1

Sorry we got cut off, my phone just auto-rebooted

Raymond Chen

Some time ago, I was on the phone when the connection suddenly cut out. I looked at the my phone display and it said, Auto-restart in 7 seconds. The seconds counted down, and then the phone rebooted, and after about ten more seconds, it was back in business, acting like nothing was wrong. (Except that it just terminated a phone call without warning, but hey, who's keeping track?) Sometimes I think phones are getting too smart for their own good. Historical note: This entry was written over four years ago, and the model of IP phone in question has long since been replaced.

Aug 20, 2012
Post comments count 0
Post likes count 1

How do I customize how my application windows are grouped in the Taskbar?

Raymond Chen

Benjamin Smedberg wants to know how to customize the icon used in the Taskbar for applications that are grouped, when the application is a runtime for multiple applications. (This is the other scenario I hinted at last time.) Actually, customizing the icon is only part of what you want to happen when your application is a runtime. In that case, you really want each inner application to be exposed to the user as an entirely separate application. In other words, if your application is hosting Product A and Product B, you want the windows for Product A and Product B to group separately, have...

Aug 17, 2012
Post comments count 0
Post likes count 0

My colleague picked a good day to go out and catch a baseball game

Raymond Chen

I ran into one of my colleagues at the coffee stand and asked him how things were going. He said that Wednesday was his wife's birthday, and he asked her if she wanted to do anything special. "Let's catch a baseball game," she suggested. So off they went to watch a baseball game. Turns out they chose a good game to watch: Seattle Mariners pitcher Félix Hernández threw a perfect game. (I like how Wikipedia has a page dedicated to the 23rd perfect game in baseball history, but no page for the first perfect game in baseball history. Because Wikipedia covers pop culture prior to 2001 very differently...

Aug 17, 2012
Post comments count 0
Post likes count 1

What if my application is really two applications bundled into a single file, and I want them collected into two groups on the taskbar in Windows 7?

Raymond Chen

A customer wanted to prevent multiple copies of their program from being grouped on the taskbar. They didn't give an explanation why, but let's assume that they are doing this for honorable purposes rather than as a way to annoy the user. For example, maybe their program is really multiple applications bundled inside a single EXE file for convenience. The information you need to do this is in MSDN under Application User Model IDs, specifically in the Where to assign an AppUserModelID section. I'll assume you've read the guidance there, and I'm just going to dive into the implementation. Suppose our scratch...

Aug 16, 2012
Post comments count 0
Post likes count 0

Charles Petzold's Programming Windows Sixth Edition has reached Release Preview

Raymond Chen

We interrupt this program for a word from Microsoft Press. A few months ago, I noted that Charles Petzold is coming back with another edition of Programming Windows, and you could have gotten in on the ground floor and ordered your copy for only $10 which included access to all prerelease versions. Well, the book has reached Release Preview, which means that the sticker price has increased to $30, so if you missed your chance earlier, you can at least get your order in before it goes up to $40 on August 28 and before it reaches its final price of $50 on November 15. And as with the people who acted quickly, y...