From 902f9c65a51de4686f253f700ae38ae0a7ec084f Mon Sep 17 00:00:00 2001 From: Gerard Patel Date: Sun, 14 Feb 1999 11:22:03 +0000 Subject: [PATCH] Fix if EndDialog called in WM_INITDIALOG (DIALOG_DoDialogBox). --- windows/dialog.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/windows/dialog.c b/windows/dialog.c index 6dc46564a84..08b972f6778 100644 --- a/windows/dialog.c +++ b/windows/dialog.c @@ -854,21 +854,24 @@ INT32 DIALOG_DoDialogBox( HWND32 hwnd, HWND32 owner ) owner = WIN_GetTopParent( owner ); if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return -1; dlgInfo = (DIALOGINFO *)wndPtr->wExtra; - EnableWindow32( owner, FALSE ); - ShowWindow32( hwnd, SW_SHOW ); - while (MSG_InternalGetMessage(&msg, hwnd, owner, MSGF_DIALOGBOX, PM_REMOVE, - !(wndPtr->dwStyle & DS_NOIDLEMSG) )) + if (!dlgInfo->flags & DF_END) /* was EndDialog called in WM_INITDIALOG ? */ { - if (!IsDialogMessage32A( hwnd, &msg)) - { - TranslateMessage32( &msg ); - DispatchMessage32A( &msg ); - } - if (dlgInfo->flags & DF_END) break; + EnableWindow32( owner, FALSE ); + ShowWindow32( hwnd, SW_SHOW ); + while (MSG_InternalGetMessage(&msg, hwnd, owner, MSGF_DIALOGBOX, + PM_REMOVE, !(wndPtr->dwStyle & DS_NOIDLEMSG) )) + { + if (!IsDialogMessage32A( hwnd, &msg)) + { + TranslateMessage32( &msg ); + DispatchMessage32A( &msg ); + } + if (dlgInfo->flags & DF_END) break; + } + EnableWindow32( owner, TRUE ); } - retval = dlgInfo->idResult; - EnableWindow32( owner, TRUE ); + retval = dlgInfo->idResult; DestroyWindow32( hwnd ); return retval; }