A: 

By calling UpdateWindow, the button is being redrawn before the focus change can take effect. The Invalidate should be sufficient by itself, the window will get repainted when everything settles down.

Mark Ransom
Ok, I removed UpdateWindow, my original problem stil persists.
rec
A: 

This draws the thick border around the button:

static_cast<CButton*>(GetDlgItem(IDC_BUTTON1))->SetButtonStyle(BS_DEFPUSHBUTTON);

A more elegant way to do this would be to define a CButton member variable in CbuttonfocusDlg and associate it to the IDC_BUTTON1 control, and then calling

this->m_myButton.SetButtonStyle(BS_DEFPUSHBUTTON);

This makes the button to which I'm setting the focus the default button, but note that when the focus goes to a control (inside the dialog) that is not a button, the default button is once more the original default button set in the dialog resource, in this case the "Ok" button.

rec
Aha, I misunderstood the question! I'm sorry, I could have come up with this answer yesterday. You kept emphasizing the word "focus", and the dotted line is the official focus indicator.
Mark Ransom
+1  A: 

Use WM_NEXTDLGCTL.

See http://blogs.msdn.com/oldnewthing/archive/2004/08/02/205624.aspx

Joel
+1. The OP is asking the wrong question, caused by a misunderstanding of how dialogs work. OP, please be careful that the behavior you implement follows 'normal' window UI rules about default buttons etc. (i.e., that pressing enter after opening the dialog does something intuitive).
Roel