The Old New Thing

Why can’t you trap TerminateProcess?

If a user fires up Task Manager and clicks "End Task" on your program, Windows first tries to shut down your program nicely, by sending WM_CLOSE messages to GUI programs and CTRL_CLOSE_EVENT events to console programs. But you don't get a chance to intercept TerminateProcess. Why not? TerminateProcess is the low-level process killing ...

Why was nine the maximum number of monitors in Windows 98?

Windows 98 was the first version of Windows to support multiple monitors. And the limit was nine. Why nine? Because that allowed you to arrange your monitors like this. You have early seventies television to thank. [Raymond is currently on vacation; this message was pre-recorded...

Querying information from an Explorer window

Sometimes software development is inventing new stuff. But often, it's just putting together the stuff you already have. Today's puzzle is one of the latter type of problem. Given a window handle, you can you determine (1) whether it is an Explorer window, and if so (2) what folder it is viewing, and (3) what item is ...

Wrapper templates to make writing callback functions slightly easier

I previously discussed why callback functions must be static if they are member functions. Writing the correct prototype for the callback function is usually somewhat clumsy. It's not hard. Just clumsy. (If you read my previous article, you'd recognizing sticking a __stdcall in the declaration for RealThreadProc as a micro-optimization.) ...

How to display a string without those ugly boxes

You've all seen those ugly boxes. When you try to display a string and the font you have doesn't support all of the characters in it, you get an ugly box for the characters that aren't available in the font. Start with our scratch program and add this to the function: That string contains the first three letters from three different ...

Don’t forget to #define UNICODE if you want Unicode

I answered this comment directly, but it deserves reiteration with wider visibility. If you don't #define UNICODE, you get ANSI by default. If you want to see characters beyond the boring 7-bit ASCII, make sure you are using a font that can display those characters. I am assuming a level of competence where issues like this go ...

Why “Under Construction” should be made illegal on the web

The site www.emr.fr has been "under construction" for over eight years. I noticed it in June 1996 and check back on it periodically. Still Under Construction. Another site that I noticed as "Under Construction" in June 1996 is www.leary.com. And as of this writing, it is still under construction...

Don't forget to #define UNICODE if you want Unicode

I answered this comment directly, but it deserves reiteration with wider visibility. If you don't #define UNICODE, you get ANSI by default. If you want to see characters beyond the boring 7-bit ASCII, make sure you are using a font that can display those characters. I am assuming a level of competence where issues like this go ...

Why "Under Construction" should be made illegal on the web

The site www.emr.fr has been "under construction" for over eight years. I noticed it in June 1996 and check back on it periodically. Still Under Construction. Another site that I noticed as "Under Construction" in June 1996 is www.leary.com. And as of this writing, it is still under construction...