The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

On writing functions that accept any specialization of a C++ template type
May 29, 2023
Post comments count 5
Post likes count 0

On writing functions that accept any specialization of a C++ template type

Raymond Chen
Raymond Chen

There are the obvious arguments, the non-obvious arguments, and the invisible arguments.

Getting a strong reference from the <CODE>this</CODE> pointer too late
May 26, 2023
Post comments count 3
Post likes count 0

Getting a strong reference from the this pointer too late

Raymond Chen
Raymond Chen

Once destruction begins, strong references mean nothing.

How can I trigger a recalc of the mouse cursor after I changed some of my internal application state?, follow-up
May 25, 2023
Post comments count 0
Post likes count 3

How can I trigger a recalc of the mouse cursor after I changed some of my internal application state?, follow-up

Raymond Chen
Raymond Chen

You still need to filter to your window, so you don't mess up another window on the same thread.

Don’t name your header file <CODE>security.h</CODE> either
May 24, 2023
Post comments count 4
Post likes count 3

Don’t name your header file security.h either

Raymond Chen
Raymond Chen

You may be overriding an SDK header by mistake.

On creating (and using) a transforming iterator
May 23, 2023
Post comments count 4
Post likes count 3

On creating (and using) a transforming iterator

Raymond Chen
Raymond Chen

It lets you change the thing being iterated over, on the fly.

Speeding up the insertion of a sorted (or mostly-sorted) key list into a <CODE>std::map</CODE> or other ordered associative container
May 22, 2023
Post comments count 1
Post likes count 3

Speeding up the insertion of a sorted (or mostly-sorted) key list into a std::map or other ordered associative container

Raymond Chen
Raymond Chen

Provide a hint for the location of the next item.

On catching exceptions in PPL tasks
May 19, 2023
Post comments count 0
Post likes count 0

On catching exceptions in PPL tasks

Raymond Chen
Raymond Chen

You also have to catch the exception when it comes out the end of the task chain.

What is the opposite of <CODE>LVM_SORTITEMS</CODE>?
May 18, 2023
Post comments count 3
Post likes count 1

What is the opposite of LVM_SORTITEMS?

Raymond Chen
Raymond Chen

How can you unring the bell?

How do I free the pointers returned by functions like <CODE>Get­Token­Information</CODE>?
May 17, 2023
Post comments count 2
Post likes count 1

How do I free the pointers returned by functions like Get­Token­Information?

Raymond Chen
Raymond Chen

They are all pointers back into the main memory block.