But, then from your next post, it looks like you are blocking the message processing loop while you do the sort? That is generally not a good idea.

I agree that it's not a generally good idea but it seems necessary in this case. And the result looks good.
When you do the above, is the mouse just stuck then?

No, I can move the mouse around and it keeps the WAIT status.