The Old New Thing

Why do we need IsDialogMessage at all?

alv wonders why we need the function at all. "All its activity could take place inside the window procedure of the modeless dialog itself", since when it doesn't have focus, it shouldn't be responding to messages anyway. Sure, that works great if the modeless dialog has focus. But it almost never does. What has focus is a control inside the...

You already know the answer since you do it yourself

A customer was writing a program that performed virtual drag/drop. They were using the technique but found that many applications don't support drag/drop of virtual content. They support only . What's more, often these applications query for on not because they want to access the file, but just because they want to get the file names (for ...

I know that an overlapped file handle requires an lpOverlapped, but why does it (sometimes) work if I omit it?

A customer observed that the formal requirements for the function specify that if the handle was opened with , then the parameter is mandatory. But the customer observed that in practice, passing results in strange behavior. Sometimes the call succeeds, and sometimes it even returns (horrors!) valid data. (Actually the more horrifying case...

Microspeak: scoped to

The Merriam-Webster dictionary gives as the meaning of scope as a verb to look at for evaluation, as in "to scope out the competition." But that's not how we use it at Microsoft. Here are some fake citations: The Widgets pop-up shows the available widgets scoped to the current selection. The results of the search are scoped to the current...

Registration-free COM the old-fashioned way: The car mp3 player

Windows XP introduced Registration-Free COM, permitting you to place your COM object registrations in a manifest rather than in the registry. Very handy when you want to support xcopy deployment or running directly off a thumb drive. And very much in keeping with the principle of not using a global solution for a local problem. (If you ...

You can use an OVERLAPPED structure with synchronous I/O, too

Even if you didn't open a file with , you can still use the structure when you issue reads and writes. Mind you, the I/O will still complete synchronously, but you can take advantage of the other stuff that has to offer. Specifically, you can take advantage of the and members to issue the I/O against a file location different from the ...

I totally presented to an executive the wrong way

Some time ago, Gray Knowlton wrote an article on how to present to an executive. As you might have guessed, I've done it completely the wrong way. Many years ago, I was part of a group presenting to a senior-level executive. I was the one who wrote the document establishing the background for the topic and laying out the various options ...