[User32]
[reactos.git] / reactos / dll / win32 / user32 / windows / dialog.c
index 909bc5d..eec7b45 100644 (file)
@@ -159,7 +159,7 @@ DIALOGINFO * DIALOG_get_info( HWND hWnd, BOOL create )
 
             SETDLGINFO( hWnd, dlgInfo );
 
-            NtUserCallHwndParam( hWnd, (DWORD_PTR)dlgInfo, HWNDPARAM_ROUTINE_SETDIALOGPOINTER );
+            NtUserCallHwndParam( hWnd, (DWORD)dlgInfo, HWNDPARAM_ROUTINE_SETDIALOGPOINTER );
         }
         else
         {
@@ -342,7 +342,7 @@ static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPL
                                         MulDiv(info.y, dlgInfo->yBaseUnit, 8),
                                         MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
                                         MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
-                                        hwnd, (HMENU)(ULONG_PTR)info.id,
+                                        hwnd, (HMENU)info.id,
                                         hInst, (LPVOID)info.data );
         }
         else
@@ -373,7 +373,7 @@ static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPL
                                             MulDiv(info.y, dlgInfo->yBaseUnit, 8),
                                             MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
                                             MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
-                                            hwnd, (HMENU)(ULONG_PTR)info.id,
+                                            hwnd, (HMENU)info.id,
                                             hInst, (LPVOID)info.data );
             }
             else
@@ -560,6 +560,12 @@ INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
                 DispatchMessageW( &msg );
             }
             if (dlgInfo->flags & DF_END) break;
+
+            if (bFirstEmpty && msg.message == WM_TIMER)
+            {
+                ShowWindow( hwnd, SW_SHOWNORMAL );
+                bFirstEmpty = FALSE;
+            }
         }
     }
     if (dlgInfo->flags & DF_OWNERENABLED) DIALOG_EnableOwner( owner );
@@ -580,10 +586,10 @@ static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
     WORD signature;
     WORD dlgver;
 
-    signature = GET_WORD(p); p++;
     dlgver = GET_WORD(p); p++;
+    signature = GET_WORD(p); p++;
 
-    if (signature == 1 && dlgver == 0xffff)  /* DIALOGEX resource */
+    if (dlgver == 1 && signature == 0xffff)  /* DIALOGEX resource */
     {
         result->dialogEx = TRUE;
         result->helpId   = GET_DWORD(p); p += 2;
@@ -612,7 +618,7 @@ static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
             p++;
             break;
         case 0xffff:
-            result->menuName = (LPCWSTR)(UINT_PTR)GET_WORD( p + 1 );
+            result->menuName = (LPCWSTR)(UINT)GET_WORD( p + 1 );
             p += 2;
             break;
         default:
@@ -630,7 +636,7 @@ static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
             p++;
             break;
         case 0xffff:
-            result->className = (LPCWSTR)(UINT_PTR)GET_WORD( p + 1 );
+            result->className = (LPCWSTR)(UINT)GET_WORD( p + 1 );
             p += 2;
             break;
         default:
@@ -968,10 +974,13 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
 
         if (dlgProc)
         {
-            if (SendMessageW( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ) &&
+            HWND focus = GetNextDlgTabItem( hwnd, 0, FALSE );
+            if (SendMessageW( hwnd, WM_INITDIALOG, (WPARAM)focus, param ) &&
                 ((~template.style & DS_CONTROL) || (template.style & WS_VISIBLE)))
             {
-                /* By returning TRUE, app has requested a default focus assignment */
+                /* By returning TRUE, app has requested a default focus assignment.
+                 * WM_INITDIALOG may have changed the tab order, so find the first
+                 * tabstop control again. */
                 dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
                 if( dlgInfo->hwndFocus )
                     SetFocus( dlgInfo->hwndFocus );