The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

I saw a fascinating documentary about bugs
Jul 22, 2009
Post comments count 0
Post likes count 0

I saw a fascinating documentary about bugs

Raymond Chen
Raymond Chen

In the September 20, 2007 Dilbert comic, Dilbert says to his date, "I saw a fascinating documentary about bugs." A Year in the Life of Ants.

Microspeak: Whale Boy
Jul 22, 2009
Post comments count 0
Post likes count 0

Microspeak: Whale Boy

Raymond Chen
Raymond Chen

Today is the tenth anniversary of Windows Live Messenger. My colleague Danny Glasser provides some history behind the product, and you can watch a tenth anniversary celebration video created for the occasion. And thus is inspired today's Microspeak: Whale Boy. Whale Boy is the nickname for the pawn-shaped Messenger buddy icon. His normal state is green, but he changes color or picks up a piece of flair to indicate various changes in status, such as busy or away. I don't know the etymology of the term, but I suspect it came from his somewhat rotund appearance. Sample usage (which I made up just now; not from ...

Proto-Microspeak: Coceptualize
Jul 21, 2009
Post comments count 0
Post likes count 0

Proto-Microspeak: Coceptualize

Raymond Chen
Raymond Chen

Many years ago, to see whether anybody was paying attention, a colleague and I slipped the made-up word "coceptualize" into a document. Nobody said a thing. Either nobody read that part of the document, or they did and thought it was a real word.

Why was MoveTo replaced with MoveToEx?
Jul 20, 2009
Post comments count 0
Post likes count 0

Why was MoveTo replaced with MoveToEx?

Raymond Chen
Raymond Chen

Commenter Ulric asks, "Where did MoveTo(HDC, int, int) go?" Back in the 16-bit days, the function to move the current point was called , and its return value was a which encoded the previous position, packing two 16-bit coordinates into a single 32-bit value. As part of the transition to 32-bit Windows, GDI switched to using 32-bit coordinates instead of the wimpy 16-bit coordinates of old. As a result, it was no longer possible to encode the original position in a single . Something new had to be developed. That new thing was the function. Instead of returning a single , it accepted a final parameter whic...

The disembodiment of DIBs from the DIB section
Jul 17, 2009
Post comments count 0
Post likes count 0

The disembodiment of DIBs from the DIB section

Raymond Chen
Raymond Chen

So far this week, we've separated the DIB metadata () from the pixels of a DIB section. But there's really no need for the DIB section at all! As long as you have the pixels and the metadata, you can draw bits. We demonstrate this by drawing a rather stupid-looking bitmap onto the screen, but doing so without the use of s at all! Start with a brand new scratch program and make these changes: We are drawing a bitmap without using an ! The technique is the same one we've been using all week: Building a and using it to guide the interpretation of a chunk of memory containing pixels. Just to make things eas...

Caption contest: The pinball machine: Results
Jul 16, 2009
Post comments count 0
Post likes count 0

Caption contest: The pinball machine: Results

Raymond Chen
Raymond Chen

It's been quite a while, but a winner in the caption contest has been selected and the prize finally reached its destination. (Mostly due to procrastination on my part. Don't blame the postal service.) The winner is Scott from Australia with his entry Only 5,000 more referrals until MULTIBALL Even though it's kind of low-brow, it made me laugh spontaneously. For his efforts, Scott wins a deluxe prize package consisting of Here's Scott's acceptance speech: I'd like to thank all the letters that made the caption possible - the O, the N, the R, and especially the L - that little guy r...

Separating the metadata from the DIB pixels: Changing the raster operation
Jul 16, 2009
Post comments count 0
Post likes count 0

Separating the metadata from the DIB pixels: Changing the raster operation

Raymond Chen
Raymond Chen

For a few days now, we've used the function in conjunction with a precomputed to draw a DIB with an alternate color table without modifying the . The function operates like a with raster operation . If you want another raster operation, you can use , which has a final raster operation parameter. Despite its name, you don't have to stretch with . Just pass a source and destination of equal size, and you've performed a NOP stretch, but you get the benefit of the raster operation. I changed the call from to , setting the source and destination rectangles to the same size (so no actual stretching occurs),...

On gender differences in expectations of thinness, and the impact on guys who live in their parents' basement
Jul 15, 2009
Post comments count 0
Post likes count 0

On gender differences in expectations of thinness, and the impact on guys who live in their parents' basement

Raymond Chen
Raymond Chen

At dinner a few years ago, one of my friends brought up a study (which I can't find, so who knows if it's actually true, but let's assume it's true for the sake of the story) that examined the effect of gender differences in expectations of thinness. One of the factors that the study considered was sexual orientation, and they found that homosexual men were, on average, thinner than their heterosexual brethren, and conversely that heterosexual women were thinner on average than their homosexual um, what's the female counterpart to "brethren"? In other words, the conclusion of the study was that the pressure to b...

Separating the metadata from the DIB pixels: Precalculating the BITMAPINFO
Jul 15, 2009
Post comments count 0
Post likes count 0

Separating the metadata from the DIB pixels: Precalculating the BITMAPINFO

Raymond Chen
Raymond Chen

Last time, we saw that you can use the function to draw a DIB with an alternate color table without having to modify the . In that version of the function, we selected the into a device context in preparation for drawing from it, but in fact that step isn't necessary for drawing. It was merely necessary to get the original color table so we could build our grayscale color table. If you don't care what the original colors are, then you can skip that step. And even if you care what the old colors are, and if you assume that the colors don't change, then you only need to ask once. To demonstrate, that all the ...