Some people didn't take to heart my cautions on the subject
of attached input queues, item number five on the list of
five things every Win32 programmer should know.
And then they find that their application stops responding.
// Code in italics is wrong
void TryToStealFocus(HWND hwnd)
{
// First try plain SetForegroundWindow
...