The Old New Thing

The King County Council race gets even stranger

I told you it was going to get weird. In the month since my last report, there have been a few developments in the county council race between an accused drunk (the incumbent) and a fringe candidate (the challenger). The Seattle Times tries to summarize the state of the race with a series of articles...

If you pass enough random numbers, eventually one of them will look valid

One customer traced a problem they were having to the way they were calling a function similar in spirit to this one: This function takes a clipboard format and looks for it on the clipboard. If found, it returns a copy of the data. Looks great, huh? The problem is that the customer would sometimes call the function as . The clipboard...

What's the deal with the EM_SETHILITE message?

If you look up the documentation on the and messages, they just say "not implemented". What's going on here? The and messages were added back in 2002 for the breadcrumb bar to use. Back in those days, the breadcrumb bar wasn't what you see in Windows Vista today, a series of buttons with drop-down arrows, each representing a level in the ...

What's the difference between LVM_HITTEST and LVM_INSERTMARKHITTEST?

One customer was confused by the two list view hit-test messages and . What is the difference between the two? The message tries to find the item the point is over. The message tries to find the item the point is next to. For example, suppose you have two 32×32 items, item zero at (0, 0) and item one at (0, 32). You use...

The best way to process Unicode input is to make somebody else do it

Andrew M asks via the Suggestion Box: I was hoping you could address how to properly code Unicode character input. It seems like a lot of applications don't support it correctly. I'm not sure I understand the question, but the answer is pretty easy: Don't do it! Text input is hard. It should be left to the professionals. This means you ...

Win32 user interface work is inherently single-threaded

At the end of the day, there's a window handle in there. As we saw a few years ago, windows have thread affinity. You can push work to a background thread all you want, but once you send a message to the window (or do something that results in a message being sent to the window), you've given control to the UI thread. Since the shell is all...

The wrong way to check whether the mouse buttons have been swapped

Back in the late 1990's, the window manager team received a bug that said that sometimes the mouse button state got messed up and the computer acted as if the buttons were stuck down. Further investigation revealed that it occurred only when one particular program was running, and only if the user had enabled mouse button swapping. The ...

How do I delay the automatic logon process?

To solve some problems you need to place one foot outside the box. We have a number of kiosk machines that are networked wirelessly. Each machine is configured with automatic logon so that things return to normal after power is restored after an outage. The problem is that the wireless switch takes a long time to recover from a power failure...