The Old New Thing

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

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

Introducing the unrolled-switch anti-pattern

Over the years, I've seen a bunch of coding anti-patterns. I figured maybe I'll share a few. Today, I'll introduce what I'm calling the unrolled-switch anti-pattern, also known as "Specialization is always faster, right?" As we all know, special-case code is faster than general-purpose code. Instead of writing slow general-purpose code...

How do I perform shell file operations while avoiding shell copy hooks?

Okay, the subject line of the article gives away the answer to the puzzle, but here's the puzzle anyway: A customer reported a problem with the function: Consider the following program: If "a" is a file, then everything works fine, but if it's a directory, then Application Verifier raises the following error: Heap violation detected ...

Why does a maximized window have the wrong window rectangle?

Commenter configurator wonders why the maximum size for a form is the screen size plus (12,12). Somebody else wonders why it's the screen size plus (16,16). Let's start by rewinding the clock to Windows 3.0. When you maximize a window, the default position of the window is such that all the resizing borders hang "off the edges of the ...

Why does my window style change when I call SetWindowText?

A customer observed some strange behavior with window styles: We ran some weird behavior: Calling the function causes a change in window styles. Specifically, calling results in the and messages, and sometimes the result is that the style is removed. Is this a bug? What would cause this? The message sends the message to the control, ...