The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

What is the default version of a header file?
Apr 10, 2007
Post comments count 0
Post likes count 0

What is the default version of a header file?

Raymond Chen
Raymond Chen

The general rule with Windows header files is that if you don't specify which version of the header file you want, you get the latest version. For example, if you have the Windows XP Platform SDK header files and you , you're going to get the Windows XP function prototypes, the Windows XP structures, the the Windows XP flags, all that stuff. And unless you're careful, the program you get as a result will most likely run only on Windows XP. If you call a function that is new for Windows XP, then your program won't run on earlier versions of Windows because the import can't be reso...

Why doesn't the taskbar return to its original size when I return my settings to their original values?
Apr 9, 2007
Post comments count 0
Post likes count 0

Why doesn't the taskbar return to its original size when I return my settings to their original values?

Raymond Chen
Raymond Chen

Commenter Gareth asked why, when the system metrics change and the taskbar changes size to match, the taskbar doesn't return to its original size when the metrics return to their previous values. Because the taskbar doesn't remember the path of changes that led to its current state. It just knows its current state. Let's say the taskbar is 30 pixels tall, consisting of one row of buttons. Now you change the metrics so that a button is now 60 pixels tall. The taskbar says, "Hm, I'm 30 pixels tall, but that's not tall enough to hold even one row of buttons. I'd better increase in height to 60 pixels so that the ...

When very young children try too hard to act nonchalant
Apr 6, 2007
Post comments count 0
Post likes count 0

When very young children try too hard to act nonchalant

Raymond Chen
Raymond Chen

Apropos of nothing (but perhaps filed as an addendum to the "stories from school" category), I was reminded of a story from the aftermath of the Nisqually Earthquake that struck Seattle in 2001. Mind you, this story is fourth-hand by now, but it's still cute. A young student, whom I will call "Billy", returned from school the day of the earthquake (which struck in mid-morning). Billy: "Hi, Mom. I'm home." Mom: "Hi, Billy. Anything interesting happen at school today?" Billy: (trying to sound nonchalant) "Nothing much." Mom: "What about the earthquake?" Billy: (surprised) "Who told you about the earthquake?!...

Code is read much more often than it is written, so plan accordingly
Apr 6, 2007
Post comments count 0
Post likes count 0

Code is read much more often than it is written, so plan accordingly

Raymond Chen
Raymond Chen

Design for readability. Even if you don't intend anybody else to read your code, there's still a very good chance that somebody will have to stare at your code and figure out what it does: That person is probably going to be you, twelve months from now. When I advised against the use of function parameters, one commenter pointed out that Intellisense shows you what the parameters are. Sure, that's a great help when you're writing the code, but you write the code only once. You read it a lot. An anonymous commenter pointed out that hovering over the offending function in the IDE shows the function declarati...

On the enduring appeal of Walker, Texas Ranger
Apr 5, 2007
Post comments count 0
Post likes count 0

On the enduring appeal of Walker, Texas Ranger

Raymond Chen
Raymond Chen

Conan O'Brien airs clips from Walker, Texas Ranger. The putative excuse for this is that, as a result of the merger of NBC with Universal Studios, he can air clips from the show without paying royalties. The real excuse, of course, is that the clips are just so unintentionally funny. This appears to be a recurring sketch on Conan, so a little hunting around will reveal plenty of other clips. This is, of course, not to be confused with Chuck Norris Facts or the Chuck Norris Fact Generator or the Young Chuck Norris sketch from Saturday Night Live...

Why can't I display a tooltip for a disabled window?
Apr 5, 2007
Post comments count 0
Post likes count 0

Why can't I display a tooltip for a disabled window?

Raymond Chen
Raymond Chen

Here's a question that floated past my field of view some time ago: When the mouse hovers over a disabled window, the tooltip associated with that window does not appear. Why is this? Why isn't this documented in MSDN? Actually, you already know the answer, and it is documented. You just have to connect the dots. When a window is disabled, it does not receive keyboard or mouse input. The documentation for says so in so many words, right in the first sentence. Next, how do tooltips know when to appear and disappear? Well, one way is to modify your window procedure so it takes all its input messages and forw...

Your chance to meet Raymond if you are near Palo Alto on the 23rd
Apr 4, 2007
Post comments count 0
Post likes count 0

Your chance to meet Raymond if you are near Palo Alto on the 23rd

Raymond Chen
Raymond Chen

There's been a slight change in plans. I will be in Palo Alto on April 23rd rather than April 20th. Not that anybody is affected by this beyond the folks at Microsoft's Silicon Valley Campus, since nobody else took me up on my offer. I guess I'm not as popular as I thought. Update 13-Apr-2007: Here's my schedule for April 23rd when I'm down San Jose way. Now the term "presentation" is a bit of an overstatement. It's really just me telling a bunch of stories, but instead of sitting at a table with a bunch of people, I'll be standing in front of a room. Same stories, different audio system. I'll have a number o...

His lips are moving: In order to serve you better
Apr 4, 2007
Post comments count 0
Post likes count 0

His lips are moving: In order to serve you better

Raymond Chen
Raymond Chen

Q: How do you know when a lawyer is lying? A: His lips are moving. This is of course a completely unfair and discriminatory joke. Many lawyers are women. Anyway, today I'm going to rant about the phrase "In order to serve you better." Whenever you hear this phrase, you are pretty much guaranteed that whatever follows will in fact not serve you better at all. When I bought tickets to see Real Madrid play against some Americans, the online ticket service gave me multiple options for receiving my tickets. I could have them mailed to me, or I could have the tickets sent to me electronically. And for some reason...

Why does my thread pool use only one thread?
Apr 3, 2007
Post comments count 0
Post likes count 0

Why does my thread pool use only one thread?

Raymond Chen
Raymond Chen

Because one thread is all it needs.