The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

SAFEARRAY after my method returns?" />
Jan 29, 2026
Post comments count 0
Post likes count 1

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

Raymond Chen

Find a way to take ownership.

SafeArrayAddRef?" />
Jan 28, 2026
Post comments count 0
Post likes count 1

Why did I lose the data even though I called SafeArrayAddRef?

Raymond Chen

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

SafeArrayAddRef and extending APIs in general" />
Jan 27, 2026
Post comments count 2
Post likes count 1

A digression on the design and implementation of SafeArrayAddRef and extending APIs in general

Raymond Chen

The concerns when adding a feature to an existing API.

SafeArrayAccessData and SafeArrayAddRef?" />
Jan 26, 2026
Post comments count 0
Post likes count 2

What's the difference between SafeArrayAccessData and SafeArrayAddRef?

Raymond Chen

Two ways of preserving the data.

scope_exit for running code at scope exit. C# says "We have scope_exit at home."" />
Jan 23, 2026
Post comments count 15
Post likes count 4

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

Raymond Chen

You can wrap it in an IDisposable.

Jan 22, 2026
Post comments count 6
Post likes count 3

A simple helper function for attaching a progress handler to a Windows Runtime IAsyncActionWithProgress or IAsyncOperationWithProgress

Raymond Chen

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

Jan 21, 2026
Post comments count 2
Post likes count 2

On the proper usage of a custom Win32 dialog class

Raymond Chen

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

Jan 20, 2026
Post comments count 5
Post likes count 2

Microspeak: On fire, putting out fires

Raymond Chen

Dealing with emergencies.

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

An old flag from 16-bit Windows.