Dialog boxes return focus to the control that had focus when you last switched away; how do I get in on that action for my own windows?

You start typing.
You start typing.
Continuing from Creating a simple pidl: For the times you care enough to send the very fake: Instead of creating a simple pidl, we'll create a simple shell item. The idea is the same. We build a file system bind context containing the information about the fake file, and we pass that bind context to the function. Take that program that creat...
Some time ago, I noted that you can build other interlocked operations out of . Here's an example: (There's a corresponding C++ version, which I leave as an exercise.) This function atomically updates a "highest value seen so far" variable. It follows the usual pattern: Capture the starting value. Do a computation based on that value. Comp...
How could it be?
A customer reported a problem showing an icon on their dialog box. We verified that this code does execute during the handling of the message. No assertion fires, yet no icon appears either. Our dialog template says The customer did some helpful preliminary troubleshooting: Verify that the code does indeed execute. It sounds obvio...
Today's Little Program enumerates bit sequences of a particular length subject to the constraint that you cannot have consecutive 0-bits. This may sound kind of arbitrary, but it is important in magnetic media storage, because you cannot go too long without a flux reversal (traditionally represented by a 1); otherwise, the read head's clock start...
Commenter Medinoc was baffled by the statement that the decision to use the visual-styles-enabled version of the common controls library is done on a window-by-window basis. " Isn't it rather on a per-module basis, depending on each module's manifest? If it is indeed on a per-window basis, how does one choose?" Whether a particular call to (or ...
Many people have noticed that the and functions (and therefore their BCL equivalent and WinRT equivalent ) fire multiple events when you save a file in Notepad. Why is that? Because multiple things were modified. Notepad opens the file for writing, writes the new data, calls to truncate any excess data (in case the new file is shorter than t...
Today's Little Program locates the × button in the corner of the window and, just to show that it found it, displays a balloon tip pointing at it. Let's start with the program from last week, the one that displays a balloon tip, then make these changes: Instead of positioning the balloon at the cursor position, we put it at the center ...
Commenter Ivo notes that if you ask to extract an icon at a particular size, the function can return which means "Go jump in a lake do it yourself." But how can you do it yourself? The and functions don't let you specify a custom size, and doesn't work with icon indices (only resource IDs). The function comes to the rescue. This takes all...