The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

You can’t simulate keyboard input with PostMessage, revisited
Mar 19, 2025
9
6

You can’t simulate keyboard input with PostMessage, revisited

Raymond Chen
Raymond Chen

If it didn't go through the input system, it only looks like input as much as the app allows itself to be fooled.

Why didn’t Windows 95 setup use a miniature version of Windows 95 as its fallback GUI?
Mar 18, 2025
7
4

Why didn’t Windows 95 setup use a miniature version of Windows 95 as its fallback GUI?

Raymond Chen
Raymond Chen

Avoiding an interim GUI environment.

Dubious security vulnerability: A program does not run correctly if you run it the wrong way
The case of COM failing to pump messages in a single-threaded COM apartment
Mar 14, 2025
0
2

The case of COM failing to pump messages in a single-threaded COM apartment

Raymond Chen
Raymond Chen

A customer encountered a hang caused by COM not pumping messages while waiting for a cross-thread operation to complete. They were using the class for serializing asynchronous operations on a UI thread they created to handle accessibility callbacks. The hang stack looked like this: We see that we have a UI thread (notice the at the bottom of the stack), yet COM decided to block without pumping messages ( instead of (). Is this a bug in the task sequencer? Let's look at the stack more closely. A message arrived via , and that then queued a task into the task sequencer. The saw that the task sequencer had...

Making sure that a DLL loads only from your application directory
Mar 13, 2025
12
2

Making sure that a DLL loads only from your application directory

Raymond Chen
Raymond Chen

You can ask for it as an option, but think about what you're actually protecting against.

What are the thread safety requirements of <CODE>HSTRING</CODE> and <CODE>BSTR</CODE>?
Mar 12, 2025
2
3

What are the thread safety requirements of HSTRING and BSTR?

Raymond Chen
Raymond Chen

They do not have thread affinity.

What an insightful observation, you get to wear “the hat”
Mar 11, 2025
9
2

What an insightful observation, you get to wear “the hat”

Raymond Chen
Raymond Chen

Maybe not so insightful.

How do I destroy an ABI pointer that I extracted from a C++/WinRT object?
Mar 10, 2025
0
4

How do I destroy an ABI pointer that I extracted from a C++/WinRT object?

Raymond Chen
Raymond Chen

You can clean it up the ABI way, whatever that is.

To some people, time zones are just a fancy way of sounding important, episode 2