The Old New Thing

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 ...

Why aren't shortcuts as easy as unix links?

Commenter dingo asks, "Why are shortcuts so hard to manipulate? Why can't they be as easy as unix links?" Well, if you want something like unix links, then you can just create a hard link. Creating them is about the same difficulty ( vs ) and manipulating them is the same since you don't actually manipulate a hard link. You just use it like a...

Which windows appear in the Alt+Tab list?

Commenter Phil Quirk wants to know what the rules are for determining which windows appear in the Alt+Tab list. It's actually pretty simple although hardly anything you'd be able to guess on your own. Note: The details of this algorithm are an implementation detail. It can change at any time, so don't rely on it. In fact, it already changed ...

Don't assume the first person to run your program is an administrator

One "optimization" I've seen from some programs is to defer a bunch of system configuration work to the first time the program is run or the first time a feature is requested instead of doing it at install time. The problem with this is that the first person to run your program is not guaranteed to be an administrator. For example, there is ...

What's the BS_PUSHLIKE button style for?

One of the lesser-known button styles is . Makes a button (such as a check box, three-state check box, or radio button) look and act like a push button. The button looks raised when it isn't pushed or checked, and sunken when it is pushed or checked. In other words, you add this style to a check box or radio button to make it look like a ...

It rather involved being on the other side of this airtight hatchway: Elevation to administrator

Surprisingly, it is not a security vulnerability that administrators can add other users to the Administrators group. But that doesn't stop people from claiming that it is. For example, it's not uncommon for a vulnerability report to come in with the following steps: Wow, this looks bad. An unprivileged user can elevate to administrator ...