Set focus to the dialog in EndDialog.

diff --git a/windows/defdlg.c b/windows/defdlg.c
index 05f234c..133dd09 100644
--- a/windows/defdlg.c
+++ b/windows/defdlg.c
@@ -53,7 +53,11 @@
 {
     if (!infoPtr->hwndFocus || IsIconic(hwnd)) return FALSE;
     if (!IsWindow( infoPtr->hwndFocus )) return FALSE;
-    DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
+
+    /* Don't set the focus back to controls if EndDialog is already called.*/
+    if (!(infoPtr->flags & DF_END))
+       DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
+
     /* This used to set infoPtr->hwndFocus to NULL for no apparent reason,
        sometimes losing focus when receiving WM_SETFOCUS messages. */
     return TRUE;