The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts

If you pass invalid parameters, then all bets are off

Alun Williams pointed out that if you pass invalid parameters to , it does not destroy the . Well, yeah, because if you pass invalid parameters, then all bets are off. Different functions perform different degrees of parameter validation; the degree to which this is done is typically guided by security concerns. Information that crosses security boundaries must be fully-validated, whereas a call to an in-process function has very little in the way of security obligations with respect to invalid parameters, since a bad caller could just mess with the in-process function directly; no need to try to "trick" it ...

Canoeing around the Washington Park Arboretum

This weekend is Opening Day of the Seattle boating season. Even if you don't own a boat, you can enjoy the warmer weather and rent a canoe and paddle around the Arboretum. (Don't do it on Opening Day, though.) Here's a nice map courtesy of the Northwest Outdoor Center. Pay heed to avoid the green section marked Caution. I made a wrong turn and ended up in the Caution area, and I found myself slogging through very shallow water. Assuming you avoid the shallows, it's a very pleasant experience. Commune with the ducks and other birds. Pull over at one of the beaches and take a lunch break (assuming you rememb...

You didn't know you could add properties by atom, and it's a good thing you didn't know

As I noted a few days ago, there is weirdness associated with properties added by atom. This weirdness stems from the fact that adding properties by atom is really a hole in the original implementation rather than something designed on purpose. The original 16-bit code for adding and removing properties went roughly like this: First, let's look at properties set and removed via integer atoms. These are simple: When setting the property, we just add it to the property list, and when removing the property, we remove it. Nothing fancy going on here. Similarly, there's nothing particularly exciting going on ...

Why every advertising agency needs to have a review panel of twelve-year-old boys

To spot the gaffe before your customers do.

Strange uses for window class atoms

When you register a window class (with the or function), you get an back. What use is this atom? Not much. You can use this atom in many places where a window class name can be used; just convert it to a string with the macro. Let's change our scratch program to illustrate: We save the atom returned by the function and use it (in the form of a ) in place of the class name. if you run this program, you'll see that it works exactly the same as the old version that used the class name. The class atom is valid as long as the class remains registered. Functions that accept a as the class name include...

Book me the next flight to Tokyo, no wait, the second flight

I know someone who has a brother who works in Taipei, Taiwan. He travels to Japan often on business, and one day he needed to fly to Tokyo on short notice. He instructed his assistant to book the next flight from Taipei to Tokyo. This is what he got. (Warning: Contains strange music.) That's right. His assistant booked him on Hello Kitty Air, initially a daily flight from Taipei to Fukuoka, but soon extended to a second run to Tokyo. Everything on this plane is Hello Kitty. The paint scheme, the flight attendants, the boarding passes, the luggage tags, the chopsticks, the sugar packets, the in-flight meals, ...

Some other places atoms (and the magical 0xC000) arise

The moment the Windows developers got a system for converting strings into numbers, they could use it anywhere they need to, well, convert a string into a number. Somtimes these integers are officially declared as atoms, but most of the time they are just integers that happen to be atoms under the covers. I'll start with registered window messages, created by the function. These are not officially atoms; they are just integers that happen to lie in the range to , just like atoms. But yeah, internally, they're atoms. Of course, you shouldn't rely on it since it's not contractual. Think of it as a fantastic coin...

Racking up the frequent shopper points at the register office

In Scotland, a 24-year-old woman got married for the fourth time. The first three ended under unusual circumstances. Let's see, for starters, marriage number one ended when her husband ran off to marry her mom, and the woman even served as a bridesmaid at her mother's wedding. Oh, and a musical thong was also involved. When I read this article, I thought, "Certainly the UK has a counterpart to The Jerry Springer Show, doesn't it?" It appears that I am not disappointed.

Why do atoms start at 0xC000?

There are two types of atoms, so-called integer atoms, which are just small integers, and, um, atoms that don't have a special adjective; these plain vanilla atoms come from functions like . (For the purpose of this discussion, I'll call them string atoms.) The atom zero is invalid (); atoms 1 through † are integer atoms, and atoms from through are string atoms. Why is the value of ? The reason has its roots in 16-bit Windows. Atoms are kept in a, well, atom table. The details of the atom table aren't important aside from the fact that the nodes in the atom table are allocated from the heap, and each n...