The Old New Thing

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

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

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

Windows doesn't close windows when a user logs off; that's your call

Commenter Peter Kankowski asks why Windows doesn't send and messages when the user logs off. That's what is for. To tell the program that the Windows session is ending, and that you should get done whatever last things you want to get done before the world comes to an end. Windows doesn't send the message because sending becomes ...

Use the #error directive to check whether the compiler even sees you

You may find yourself in a twisty maze of s. Or you may be wondering why your macros aren't working. I have these lines in my header file: but when I try to use them, I get errors. Any idea why this is happening? First, make sure the compiler even sees you. Notice that for macros, generating a preprocessed file doesn't accomplish ...

You can drag multiple virtual objects, you know

A customer wanted to know how they could find out the directory that the user dropped a file onto. As we already noted, users can drop files onto things other than directories, so the question itself comes with incorrect hidden assumptions. This is another one of those cases where you have to ask the customer, "What are you really trying to ...