Maybe there's a way to let the dialog know which button is the current default button? I now have this code, but it only changes the looks of the buttons. Apparently a button with BS_DEFPUSHBUTTON set still isn't a real default button for the dialog...
Code:
case WM_COMMAND:
if(HIWORD(wParam) == EN_SETFOCUS) {
switch(LOWORD(wParam)) {
case ID_JOIN_IP:
case ID_JOIN_PORT:
SendDlgItemMessage(hwnd, ID_CREATE, BM_SETSTYLE, BS_PUSHBUTTON, TRUE);
SendDlgItemMessage(hwnd, ID_JOIN, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE);
break;
case ID_CREATE_PORT:
SendDlgItemMessage(hwnd, ID_JOIN, BM_SETSTYLE, BS_PUSHBUTTON, TRUE);
SendDlgItemMessage(hwnd, ID_CREATE, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE);
break;
}
}
I'll go with subclassing for now, but maybe someone knows wether it's possible to let the dialog know which button is the default one.