The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Intercepting messages inside <CODE>Is­Dialog­Message</CODE>, fine-tuning the message filter
Feb 27, 2026
Post comments count 2
Post likes count 2

Intercepting messages inside Is­Dialog­Message, fine-tuning the message filter

Raymond Chen
Raymond Chen

Making sure it triggers when you need it, and not when you don't.

Intercepting messages inside <CODE>Is­Dialog­Message</CODE>, installing the message filter
Feb 26, 2026
Post comments count 1
Post likes count 2

Intercepting messages inside Is­Dialog­Message, installing the message filter

Raymond Chen
Raymond Chen

Using an <CODE>Is­Dialog­Message</CODE> extension point.

Intercepting messages before <CODE>Is­Dialog­Message</CODE> can process them
Feb 25, 2026
Post comments count 3
Post likes count 1

Intercepting messages before Is­Dialog­Message can process them

Raymond Chen
Raymond Chen

Process the message before you let <CODE>Is­Dialog­Message</CODE> see it.

Customizing the ways the dialog manager dismisses itself: Isolating the Close pathway
Feb 24, 2026
Post comments count 2
Post likes count 2

Customizing the ways the dialog manager dismisses itself: Isolating the Close pathway

Raymond Chen
Raymond Chen

Intercepting the flow in your message loop.

Customizing the ways the dialog manager dismisses itself: Detecting the ESC key, second (failed) attempt
Feb 23, 2026
Post comments count 0
Post likes count 2

Customizing the ways the dialog manager dismisses itself: Detecting the ESC key, second (failed) attempt

Raymond Chen
Raymond Chen

Sniffing the synchronous keyboard state is still not precise enough.

The 2026/2027 Seattle Symphony subscription season at a glance
Feb 20, 2026
Post comments count 0
Post likes count 0

The 2026/2027 Seattle Symphony subscription season at a glance

Raymond Chen
Raymond Chen

The pocket reference guide for 2026/2027.

Customizing the ways the dialog manager dismisses itself: Detecting the ESC key, first (failed) attempt
Feb 20, 2026
Post comments count 12
Post likes count 3

Customizing the ways the dialog manager dismisses itself: Detecting the ESC key, first (failed) attempt

Raymond Chen
Raymond Chen

Sniffing the asynchronous keyboard state.

Exploring the signals the dialog manager uses for dismissing a dialog
Feb 19, 2026
Post comments count 1
Post likes count 6

Exploring the signals the dialog manager uses for dismissing a dialog

Raymond Chen
Raymond Chen

Summarizing the flow.

Could <CODE>Write­Process­Memory</CODE> be made faster by avoiding the intermediate buffer?
Feb 18, 2026
Post comments count 3
Post likes count 2

Could Write­Process­Memory be made faster by avoiding the intermediate buffer?

Raymond Chen
Raymond Chen

I guess it could, but why bother?

Microspeak: Escrow
Feb 17, 2026
Post comments count 8
Post likes count 2

Microspeak: Escrow

Raymond Chen
Raymond Chen

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
Feb 16, 2026
Post comments count 10
Post likes count 2

It rather involved being on the other side of the airtight hatchway: Tricking(?) a program into reading files

Raymond Chen
Raymond Chen

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 <CODE>WM_<WBR>CHAR</CODE> message?
Feb 13, 2026
Post comments count 10
Post likes count 4

How can I distinguish between the numeric keypad 0 and the top-row 0 in the WM_CHAR message?

Raymond Chen
Raymond Chen

See if it matches the scan code.

How can I distinguish between the numeric keypad 0 and the top-row 0 in the <CODE>WM_<WBR>KEY­DOWN</CODE> message?
Feb 12, 2026
Post comments count 2
Post likes count 3

How can I distinguish between the numeric keypad 0 and the top-row 0 in the WM_KEY­DOWN message?

Raymond Chen
Raymond Chen

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?
Feb 11, 2026
Post comments count 0
Post likes count 4

How do I suppress the hover effects when I put a Win32 common controls ListView in single-click mode?

Raymond Chen
Raymond Chen

You can prevent the item from becoming hot-tracked.

How did Windows 95 get permission to put the Weezer video <I>Buddy Holly</I> on the CD?
Feb 10, 2026
Post comments count 11
Post likes count 6

How did Windows 95 get permission to put the Weezer video Buddy Holly on the CD?

Raymond Chen
Raymond Chen

Asking nicely, and asking a lot of people.

What should I do if a wait call reports <CODE>WAIT_<WBR>ABANDONED</CODE>?
Feb 9, 2026
Post comments count 3
Post likes count 3

What should I do if a wait call reports WAIT_ABANDONED?

Raymond Chen
Raymond Chen

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
Feb 6, 2026
Post comments count 1
Post likes count 3

How can I prevent the user from changing the widths of ListView columns in version 5 of the common controls?, part 2

Raymond Chen
Raymond Chen

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?
Feb 5, 2026
Post comments count 6
Post likes count 2

How can I prevent the user from changing the widths of ListView columns in version 5 of the common controls?

Raymond Chen
Raymond Chen

Deny changes to the width.

Super Bowl LX creates an opportunity for symphonic friendly wagering
Feb 4, 2026
Post comments count 2
Post likes count 1

Super Bowl LX creates an opportunity for symphonic friendly wagering

Raymond Chen
Raymond Chen

Betting classical music.

How can I prevent the user from changing the widths of ListView columns?
Feb 4, 2026
Post comments count 3
Post likes count 2

How can I prevent the user from changing the widths of ListView columns?

Raymond Chen
Raymond Chen

You can ask the header to be non-resizing.

Some small stories about the giant satellite dish antenna that was behind Microsoft Building 11
Feb 3, 2026
Post comments count 0
Post likes count 7

Some small stories about the giant satellite dish antenna that was behind Microsoft Building 11

Raymond Chen
Raymond Chen

A little trivia.

Studying compiler error messages closely: Input file paths
Feb 2, 2026
Post comments count 5
Post likes count 2

Studying compiler error messages closely: Input file paths

Raymond Chen
Raymond Chen

Are you even compiling the correct file?

Why not store the <CODE>SAFEARRAY</CODE> reference count as a hidden allocation next to the <CODE>SAFEARRAY</CODE>?
Jan 30, 2026
Post comments count 1
Post likes count 1

Why not store the SAFEARRAY reference count as a hidden allocation next to the SAFEARRAY?

Raymond Chen
Raymond Chen

The case of "Bring your own <CODE>SAFEARRAY</CODE>."

How can I retain access to the data in a <CODE>SAFEARRAY</CODE> after my method returns?
Jan 29, 2026
Post comments count 1
Post likes count 2

How can I retain access to the data in a SAFEARRAY after my method returns?

Raymond Chen
Raymond Chen

Find a way to take ownership.

Why did I lose the data even though I called <CODE>Safe­Array­Add­Ref</CODE>?
Jan 28, 2026
Post comments count 0
Post likes count 1

Why did I lose the data even though I called Safe­Array­Add­Ref?

Raymond Chen
Raymond Chen

You have to use the original pointer, but even that won't be good enough.

A digression on the design and implementation of <CODE>Safe­Array­Add­Ref</CODE> and extending APIs in general
Jan 27, 2026
Post comments count 2
Post likes count 2

A digression on the design and implementation of Safe­Array­Add­Ref and extending APIs in general

Raymond Chen
Raymond Chen

The concerns when adding a feature to an existing API.

What’s the difference between <CODE>Safe­Array­Access­Data</CODE> and <CODE>Safe­Array­Add­Ref</CODE>?
Jan 26, 2026
Post comments count 0
Post likes count 3

What’s the difference between Safe­Array­Access­Data and Safe­Array­Add­Ref?

Raymond Chen
Raymond Chen

Two ways of preserving the data.

C++ has <CODE>scope_exit</CODE> for running code at scope exit. C# says “We have <CODE>scope_exit</CODE> at home.”
Jan 23, 2026
Post comments count 15
Post likes count 6

C++ has scope_exit for running code at scope exit. C# says “We have scope_exit at home.”

Raymond Chen
Raymond Chen

You can wrap it in an <CODE>IDisposable</CODE>.

A simple helper function for attaching a progress handler to a Windows Runtime IAsync­Action­With­Progress or IAsync­Operation­With­Progress
Jan 22, 2026
Post comments count 6
Post likes count 3

A simple helper function for attaching a progress handler to a Windows Runtime IAsync­Action­With­Progress or IAsync­Operation­With­Progress

Raymond Chen
Raymond Chen

It doesn't do much, but it saves typing.

On the proper usage of a custom Win32 dialog class
Jan 21, 2026
Post comments count 2
Post likes count 2

On the proper usage of a custom Win32 dialog class

Raymond Chen
Raymond Chen

You are replacing the window procedure, not the dialog procedure.

Microspeak: On fire, putting out fires
Jan 20, 2026
Post comments count 5
Post likes count 2

Microspeak: On fire, putting out fires

Raymond Chen
Raymond Chen

Dealing with emergencies.

What was the secret sauce that allows for a faster restart of Windows 95 if you hold the shift key?
Jan 19, 2026
Post comments count 8
Post likes count 7

What was the secret sauce that allows for a faster restart of Windows 95 if you hold the shift key?

Raymond Chen
Raymond Chen

An old flag from 16-bit Windows.

How can I get the tab index number from a dialog box control?
Jan 16, 2026
Post comments count 1
Post likes count 2

How can I get the tab index number from a dialog box control?

Raymond Chen
Raymond Chen

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
Jan 15, 2026
Post comments count 26
Post likes count 4

When programs assume that the system will never change, episode 4: Stealing strings

Raymond Chen
Raymond Chen

The strings are an implementation detail.

Clipping the focus item when looking for its on-screen location, part 3
Jan 14, 2026
Post comments count 0
Post likes count 1

Clipping the focus item when looking for its on-screen location, part 3

Raymond Chen
Raymond Chen

Finding <I>all</I> the clipping parents.

Clipping the focus item when looking for its on-screen location, part 2
Jan 13, 2026
Post comments count 1
Post likes count 2

Clipping the focus item when looking for its on-screen location, part 2

Raymond Chen
Raymond Chen

Finding the correct clipping parent.

Clipping the focus item when looking for its on-screen location
Jan 12, 2026
Post comments count 0
Post likes count 2

Clipping the focus item when looking for its on-screen location

Raymond Chen
Raymond Chen

Preventing the cursor from pointing to nothing.

Using Active Accessibility to find out where the focus item is
Jan 9, 2026
Post comments count 1
Post likes count 1

Using Active Accessibility to find out where the focus item is

Raymond Chen
Raymond Chen

Looking at child objects.

Using Active Accessibility to find out where the Windows caret is
Jan 8, 2026
Post comments count 4
Post likes count 2

Using Active Accessibility to find out where the Windows caret is

Raymond Chen
Raymond Chen

It's old and rather simple, but we like simple.

How can I find out where the Windows caret is?
Jan 7, 2026
Post comments count 1
Post likes count 1

How can I find out where the Windows caret is?

Raymond Chen
Raymond Chen

You'll have go to a larger scope.

Swapping two blocks of memory that reside inside a larger block, in constant memory, refinement
Jan 6, 2026
Post comments count 1
Post likes count 2

Swapping two blocks of memory that reside inside a larger block, in constant memory, refinement

Raymond Chen
Raymond Chen

Could do with a little less rotating.

How can you swap two non-adjacent blocks of memory using only forward iterators?
Jan 5, 2026
Post comments count 1
Post likes count 3

How can you swap two non-adjacent blocks of memory using only forward iterators?

Raymond Chen
Raymond Chen

Applying the rotation trick to our new problem.

How can you swap two adjacent blocks of memory using only forward iterators?
Jan 2, 2026
Post comments count 0
Post likes count 2

How can you swap two adjacent blocks of memory using only forward iterators?

Raymond Chen
Raymond Chen

A different algorithm, employing a different kind of cleverness.

Swapping two blocks of memory that reside inside a larger block, in constant memory
Jan 1, 2026
Post comments count 10
Post likes count 2

Swapping two blocks of memory that reside inside a larger block, in constant memory

Raymond Chen
Raymond Chen

A variation on the constant-memory rotation.

2025 year-end link clearance
Dec 31, 2025
Post comments count 5
Post likes count 2

2025 year-end link clearance

Raymond Chen
Raymond Chen

Another year gets relegated to history.