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

Why can you set each monitor to a different color depth?

Random832 seemed horrified by the fact that it is possible to run multiple monitors, with different color formats on each monitor. "Seriously, why does it let you do that?" Well, of course you can do that. Why shouldn't it let you do that? When multiple monitors were introduced to Windows, video hardware was nowhere near as advanced as it is today. One common discovery was that your computer, which came with a video card in one of the expansion slots, actually had a video chip baked into the motherboard, but which was disabled in the BIOS. In other words, your computer was actually multiple-monitor-capable; it'...

Hey, let's report errors only when nothing is at stake!

Only an idiot would have parameter validation, and only an idiot would not have it. In an attempt to resolve this paradox, commenter Gabe suggested, "When running for your QA department, it should crash immediately; when running for your customer, it should silently keep going." A similar opinion was expressed by commenter Koro and some others. This replaces one paradox with another. Under the new regime, your program reports errors only when nothing is at stake. "Report problems when running in test mode, and ignore problems when running on live data." Isn't this backwards? Shouldn't we be more sensitive to p...

Simulating input via WM_CHAR messages may fake out the recipient but it won't fake out the input system

We saw some time ago that you can't simulate keyboard input with . You may get away with it, depending on how the application you're trying to fake out processes input, but since you're just faking data, the application may discover that it's all a ruse when they try to access information that you didn't fake out, say by calling and discovering that the key it was told was being pressed is in fact not being pressed after all. When you try to do this fake-out, you might or might not be able to fake out the application, but you're definitely not going to fake out the input system itself. I wrote a test program ...

Luxurifying the camping experience in a different direction

Some time ago, I noted the increasing luxurification of camping, where people with more money than sense decide to go through the camping experience without building any of the character that comes with it. But that's not the only direction luxurification has moved. Unwilling to accept that "getting there is half the fun", some people take chartered planes to and from summer camp. Stick it out for the punch line in the final sentence of the article.

You don't need to ask me a question the compiler can answer more accurately

A customer reported having problems developing the correct p/invoke signature for the structure. "The code works on 32-bit machines, but on 64-bit machines, the call to returns ." The sample code included the lines My response was simply, "I bet you are passing the wrong structure size. Note that on 64-bit Windows, the alignment of the inner structures is 8-byte rather than 4-byte. Write a C++ program that does the same thing and compare." The customer decided to read only the first sentence of my reply, possibly the second, and ignore the third. "So what size should the structure be on 64-bit machines...

No, we're not going to play Stairway to Heaven, and please tell everbody else in your area code to stop calling me

Some time ago, I told the story of how one employee's phone received calls intended for a local radio station's contest line due to people dialing seven digits instead of ten and defaulting to the wrong area code. Upon reading that story, a colleague of mine pointed out that one of the conference rooms in his building has a similar problem. The direct line for the conference room is identical to the request line for a local radio station, save for the area code. People who work in the building know never to answer the phone in that conference room. (Although apparently there have been a couple of pranks involv...

How is it possible to run Wordpad by just typing its name even though it isn’t on the PATH?

It's in the App Paths.

How do I disable windowless control support in dialog boxes?

A customer wanted to know how to disable windowless control support in dialog boxes. "The customer has a CommandButton ActiveX control on his dialog box, and using to get the window handle of the command button succeeded with VC 6.0, but when compiled with VC 9.0, it does not create a window. I'm guessing that this is caused by 's support for windowless controls. Is it possible to disable support for windowless controls?" The question on its face is somewhat puzzling, because dialog boxes don't "support" or "not support" windowless controls. It's like asking, "I want rice that doesn't support meat. My...

Why is secur32.dll called secur32.dll and not secure32.dll?

Many years ago, in a discussion of why you shouldn't name your DLL "security.dll", I dug a bit into the history behind the DLL. Here are some other useless tidbits about that file. Originally, there were two DLLs called . One was the 32-bit version and one was the 16-bit version. They could coexist because the 32-bit version was in the directory and the 16-bit version was in the directory. And then Windows 95 showed up and screwed up everything. Windows 95 did not have separate and directories. All the system files, both 16-bit and 32-bit, were lumped together in a single directory. When the Se...