How can I change the default button of a dialog.
I have tried to change the default button with the following code (where the button B1 is predefined to be the default button):
UINT bs = m_B1.GetButtonStyle();
m_B1.SetButtonStyle(bs & !BS_DEFPUSHBUTTON);
bs = m_B2.GetButtonStyle();
m_B2.SetButtonStyle(bs | BS_DEFPUSHBUTTON);
But, when I press the tab key to go to the next item in the dialog, the previous default button (B1) shows up again (together with the new default button (B2)). And when the enter key is pressed, it is the old default button's code that is called.
What am I doing wrong here?