The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
What sort of horrible things happen if my dialog has a non-button with the control ID of IDCANCEL?
You get notifications that might not make sense.
Intercepting messages inside IsDialogMessage, fine-tuning the message filter
Making sure it triggers when you need it, and not when you don't.
Intercepting messages inside IsDialogMessage, installing the message filter
Using an <CODE>IsDialogMessage</CODE> extension point.
Intercepting messages before IsDialogMessage can process them
Process the message before you let <CODE>IsDialogMessage</CODE> see it.
Customizing the ways the dialog manager dismisses itself: Isolating the Close pathway
Intercepting the flow in your message loop.
Customizing the ways the dialog manager dismisses itself: Detecting the ESC key, second (failed) attempt
Sniffing the synchronous keyboard state is still not precise enough.
The 2026/2027 Seattle Symphony subscription season at a glance
The pocket reference guide for 2026/2027.
Customizing the ways the dialog manager dismisses itself: Detecting the ESC key, first (failed) attempt
Sniffing the asynchronous keyboard state.
Exploring the signals the dialog manager uses for dismissing a dialog
Summarizing the flow.
Could WriteProcessMemory be made faster by avoiding the intermediate buffer?
I guess it could, but why bother?
Microspeak: Escrow
Final build, final, final, final 2, ship this one.
It rather involved being on the other side of the airtight hatchway: Tricking(?) a program into reading files
Is it really a trick when reading the file is the purpose of the program?
How can I distinguish between the numeric keypad 0 and the top-row 0 in the WM_CHAR message?
See if it matches the scan code.
How can I distinguish between the numeric keypad 0 and the top-row 0 in the WM_KEYDOWN message?
Check whether it is an extended key.
How do I suppress the hover effects when I put a Win32 common controls ListView in single-click mode?
You can prevent the item from becoming hot-tracked.
How did Windows 95 get permission to put the Weezer video Buddy Holly on the CD?
Asking nicely, and asking a lot of people.
What should I do if a wait call reports WAIT_ABANDONED ?
It's your one chance to make amends.
How can I prevent the user from changing the widths of ListView columns in version 5 of the common controls?, part 2
Preventing the resize cursor from appearing.
How can I prevent the user from changing the widths of ListView columns in version 5 of the common controls?
Deny changes to the width.
Super Bowl LX creates an opportunity for symphonic friendly wagering
Betting classical music.
How can I prevent the user from changing the widths of ListView columns?
You can ask the header to be non-resizing.
Some small stories about the giant satellite dish antenna that was behind Microsoft Building 11
A little trivia.
Studying compiler error messages closely: Input file paths
Are you even compiling the correct file?
Why not store the SAFEARRAY reference count as a hidden allocation next to the SAFEARRAY?
The case of "Bring your own <CODE>SAFEARRAY</CODE>."
How can I retain access to the data in a SAFEARRAY after my method returns?
Find a way to take ownership.
Why did I lose the data even though I called SafeArrayAddRef?
You have to use the original pointer, but even that won't be good enough.
A digression on the design and implementation of SafeArrayAddRef and extending APIs in general
The concerns when adding a feature to an existing API.
What’s the difference between SafeArrayAccessData and SafeArrayAddRef?
Two ways of preserving the data.
C++ has scope_exit for running code at scope exit. C# says “We have scope_exit at home.”
You can wrap it in an <CODE>IDisposable</CODE>.
A simple helper function for attaching a progress handler to a Windows Runtime IAsyncActionWithProgress or IAsyncOperationWithProgress
It doesn't do much, but it saves typing.
On the proper usage of a custom Win32 dialog class
You are replacing the window procedure, not the dialog procedure.
Microspeak: On fire, putting out fires
Dealing with emergencies.
What was the secret sauce that allows for a faster restart of Windows 95 if you hold the shift key?
An old flag from 16-bit Windows.
How can I get the tab index number from a dialog box control?
The tab index number is an authoring concept, not a runtime concept.
When programs assume that the system will never change, episode 4: Stealing strings
The strings are an implementation detail.
Clipping the focus item when looking for its on-screen location, part 3
Finding <I>all</I> the clipping parents.
Clipping the focus item when looking for its on-screen location, part 2
Finding the correct clipping parent.
Clipping the focus item when looking for its on-screen location
Preventing the cursor from pointing to nothing.
Using Active Accessibility to find out where the focus item is
Looking at child objects.
Using Active Accessibility to find out where the Windows caret is
It's old and rather simple, but we like simple.
How can I find out where the Windows caret is?
You'll have go to a larger scope.
Swapping two blocks of memory that reside inside a larger block, in constant memory, refinement
Could do with a little less rotating.
How can you swap two non-adjacent blocks of memory using only forward iterators?
Applying the rotation trick to our new problem.
How can you swap two adjacent blocks of memory using only forward iterators?
A different algorithm, employing a different kind of cleverness.
Swapping two blocks of memory that reside inside a larger block, in constant memory
A variation on the constant-memory rotation.
2025 year-end link clearance
Another year gets relegated to history.
Understanding and mitigating a stack overflow in our task sequencer
The recurring problem of synchronous resumption.
Additional notes on color-keyed overlays as a way of doing smooth video rendering
Choosing the color-key and other brief discussions.
The Gävle Goat (Gävlebocken) succumbs in 2025 to a new menace
You could blow me over.
How can I detect that the system is running low on memory? Or that my job is running low on memory?
You can register for a memory notification.
Why are we worried about memory access semantics? Full barriers should be enough for anybody
You have to find new ways of going faster.
Reading the fine print, episode 4: Holiday promotions
Checking those validity dates.
Why is the last letter of my string not making it to the clipboard?
The struggle for null termination.
Why does my Ctrl+M accelerator key activate when I press the Enter key?
Understanding the difference between keys and characters for accelerators.
When irate product support customers demand to speak to Bill Gates
So transfer them to his office, or so it seems.
All the other cool languages have try…finally. C++ says “We have try…finally at home.”
The destructor serves as the "finally".
A shortcut gives me a weird path for a program shortcut that doesn’t point to the executable, so what is it?
It's a placeholder because the shortcut is to an MSI application.
Concluding thoughts on our deep dive into Windows clipboard text conversion
Stick to Unicode and you'll be fine.
Deducing the consequences of Windows clipboard text formats on UTF-8
Working out the implications.
Why is the Windows clipboard taking the scenic route when converting from CF_TEXT to CF_OEMTEXT ?
Something is forcing it down an alternate path.
Misunderstanding what the Cricket Celebration Bowl is
Apparently, not a bowl of crickets.
The Windows clipboard automatic text conversion algorithm is path-dependent
When the journey is not half of the fun.
Resolving an ambiguity in the Windows clipboard automated text conversion table
Who goes first?
Studying the various locale mismatch scenarios in Windows clipboard text format synthesis
If they don't match, then the 8-bit strings are basically broken already.
How does Windows synthesize the CF_LOCALE clipboard format?
Getting it from a place that might have been obvious in the past, but maybe not today.
How does Windows synthesize CF_UNICODETEXT from CF_TEXT and vice versa?
Let's ask the locale.
How does Windows synthesize CF_OEMTEXT from CF_TEXT and vice versa?
Starting with the easy case, or at least it looks easy.
How can my process read its own standard output?
You'll have to trick yourself before anybody notices, which may not be possible.
How can I read the standard output of an already-running process?
You can't. You'll have to do it before the process starts.
How do I check whether the user has permission to create files in a directory?
Request the directory security attributes that correspond to your proposed operation.
Microspeak: Big rocks
The large obstacles.
How do I get my edit control text to be autoselected when I choose it to be the default focus in my dialog?
Remembering some old APIs.
How can I have a Win32 drop-down combo box with a read-only edit control?
You can ask for its handle and mark it read-only.
Message-only windows are for messaging, not as a convenient victim for hosting UI
If you want to host UI, use a real window (possibly hidden).
At what point in the Windows development cycle is it too late to change the text of a translatable string?
The translation team sets the deadline.
The apocryphal origins of the Hot Dog Stand color scheme
Challenge accepted.
Why does XAML break down when I have an element that is half a billion pixels tall?
You've far exceeded the design goals and have even exceeded the expressive ability of a float.
Maybe somebody can explain to me how weak references solve the ODR problem
I don't see it.
In the commit-on-demand pattern, what happens if an access violation straddles multiple pages?
The access violation exceptions will continue until commit improves.
Is WriteProcessMemory faster than shared memory for transferring data between two processes?
Shared memory is the copy-free solution.
Microspeak: Little-r
Harkening back to a very old mail program.
How can I detect that Windows is running in S-Mode, redux
Doing it on hard mode.
I can use WM_COPYDATA to send a block of data to another window, but how does it send data back?
They can send it back with their own <CODE>WM_<WBR>COPYDATA</CODE> message, or they can put it in an agreed-upon shared location.
Could we use CTAD to simplify the use of WRL’s Callback function?
Not directly, but maybe indirectly.
Non-recursively deleting a binary tree in constant space: Rotating the tree
Preserving in-order while linearizing.
Behind the scenes on how Windows 95 application compatibility patched broken programs
Replacing bytes with the greatest of care.
How did Windows 3.1 distinguish two different programs that happened to share the same executable name?
The trouble with disambiguation.
Non-recursively deleting a binary tree in constant space: Restructuring the tree
Changing the tree structure to make it easier to delete.
Non-recursively deleting a binary tree in constant space: Synthesizing the parent pointer
Making one as you go.
Non-recursively deleting a binary tree in constant space: Traversal with parent pointers
First assume that you have a parent pointer.