The Old New Thing

Make sure you disable the correct window for modal UI

Some time ago, I was asked to look at two independent problems with people trying to do modal UI manually. Well, actually, when the issues were presented to me, they weren't described in quite that way. They were more along the lines of, "Something strange is happening in our UI. Can you help?" Only in the discussion of the scenarios did it ...

Psychic debugging: Why doesn't my program show up when I call ShellExecute?

This question came in from a customer (paraphrased): If I run my program from the command prompt, it works great, but if I run it from my launcher via , it never appears. See how good your psychic powers are at solving this problem before I give you the second question that gives away the answer. Any luck? Here's a second question ...

No good deed goes unpunished, part 2

Sometimes you're better off keeping your fool mouth shut. When I reply to a question on an internal discussion list, often with a clarifying question rather than an answer, it will occasionally happen that the person I replied to will send a response directly to me rather than including the discussion list. This is bad for a few reasons. ...

What does the letter "T" in LPTSTR stand for?

The "T" in comes from the "T" in . I don't know for certain, but it seems pretty likely that it stands for "text". By comparison, the "W" in probably comes from the C language standard, where it stands for "wide...

How do I prevent multi-line edit controls from eating the Enter key?

You might decide to put a multi-line edit control in a dialog box, not because you want the user to input multi-line data, but because it's a convenient way to display multi-line text. When you do that, you may notice that the Enter key does not invoke the default dialog button, as you might normally expect. That's because the multi-line edit ...

When something is available for the user, which user are we talking about?

Some people have taken issue with the term for the name of the base of the message range that is the province of the window class implementor. (Refresher for those who forget which messages belong to whom.) The complaint is that the user can't use them since they belong to the window class. Aha, but the real question is, "Who is the user?" ...

A very brief return to part 6 of Loading the Chinese/English dictionary

Back in Part 6 of the first phase of the "Chinese/English dictionary" series (a series which I intend to get back to someday but somehow that day never arrives), I left an exercise related to the member of the union. Alignment is one of those issues that people who grew up with a forgiving processor architecture tend to ignore. In this ...

When you crash, make sure you crash in the right place

Last time, I recommended that functions should just crash when given invalid pointers. There's a subtlety to this advice, however, and that's making sure you crash in the right place. If your function and your function's caller both reside on the same side of a security boundary, then go ahead and crash inside your function. If the caller is ...

Isn't DDE all asynchronous anyway?

"Isn't DDE all asynchronous anyway?" asks commenter KaiArnold. It's mostly asynchronous, but not entirely. You can read about how DDE works in MSDN, but since it seems people are reluctant to read the formal documentation, I'll repeat here the points relevant to the discussion. The DDE process begins with a search for a service provider. ...