The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

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 2

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 1

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 5

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 6

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.

Understanding and mitigating a stack overflow in our task sequencer
Dec 31, 2025
Post comments count 1
Post likes count 2

Understanding and mitigating a stack overflow in our task sequencer

Raymond Chen
Raymond Chen

The recurring problem of synchronous resumption.

Additional notes on color-keyed overlays as a way of doing smooth video rendering
Dec 30, 2025
Post comments count 6
Post likes count 3

Additional notes on color-keyed overlays as a way of doing smooth video rendering

Raymond Chen
Raymond Chen

Choosing the color-key and other brief discussions.