Fix processing of IDCANCEL command.

Don't change settings if the user canceled the "Custom" dialog.
This commit is contained in:
Pavel Roskin 2003-09-29 20:13:14 +00:00 committed by Alexandre Julliard
parent 803d9a8997
commit 50a4503c30
2 changed files with 10 additions and 5 deletions

View File

@ -47,7 +47,7 @@ BOOL CALLBACK CustomDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
return TRUE;
case IDCANCEL:
EndDialog( hDlg, 0 );
EndDialog( hDlg, 1 );
return TRUE;
}
break;
@ -105,6 +105,7 @@ BOOL CALLBACK TimesDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
case WM_COMMAND:
switch( LOWORD( wParam ) ) {
case IDOK:
case IDCANCEL:
EndDialog( hDlg, 0 );
return TRUE;
}
@ -122,6 +123,7 @@ BOOL CALLBACK AboutDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
case WM_COMMAND:
switch( LOWORD( wParam ) ) {
case IDOK:
case IDCANCEL:
EndDialog( hDlg, 0 );
return TRUE;
}
@ -129,4 +131,3 @@ BOOL CALLBACK AboutDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
}
return FALSE;
}

View File

@ -441,8 +441,14 @@ void DestroyBoard( BOARD *p_board )
void SetDifficulty( BOARD *p_board, DIFFICULTY difficulty )
{
HMENU hMenu = GetMenu( p_board->hWnd );
HMENU hMenu;
if ( difficulty == CUSTOM )
if (DialogBoxParam( p_board->hInst, "DLG_CUSTOM", p_board->hWnd,
CustomDlgProc, (LPARAM) p_board) != 0)
return;
hMenu = GetMenu( p_board->hWnd );
CheckMenuItem( hMenu, IDM_BEGINNER + p_board->difficulty, MF_UNCHECKED );
p_board->difficulty = difficulty;
CheckMenuItem( hMenu, IDM_BEGINNER + difficulty, MF_CHECKED );
@ -467,8 +473,6 @@ void SetDifficulty( BOARD *p_board, DIFFICULTY difficulty )
break;
case CUSTOM:
DialogBoxParam( p_board->hInst, "DLG_CUSTOM", p_board->hWnd,
CustomDlgProc, (LPARAM) p_board);
break;
}
}