[DXDIAG]
authorChristoph von Wittich <christoph_vw@reactos.org>
Tue, 16 Mar 2010 10:47:04 +0000 (10:47 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Tue, 16 Mar 2010 10:47:04 +0000 (10:47 +0000)
get next button to work

svn path=/trunk/; revision=46220

reactos/base/applications/dxdiag/dxdiag.c
reactos/base/applications/dxdiag/system.c

index 3985fae..2c9bc70 100644 (file)
@@ -126,7 +126,6 @@ InitializeTabCtrl(HWND hwndDlg, PDXDIAG_CONTEXT pContext)
     pContext->hDialogs[4] = CreateDialogParamW(hInst, MAKEINTRESOURCEW(IDD_HELP_DIALOG), hTabCtrlWnd, HelpPageWndProc, (LPARAM)pContext);
 
     /* insert tab ctrl items */
-
     InsertTabCtrlItem(hTabCtrlWnd, 0, MAKEINTRESOURCEW(IDS_SYSTEM_DIALOG));
     InitializeDisplayAdapters(pContext);
     InitializeDirectSoundPage(pContext);
@@ -188,8 +187,19 @@ DxDiagWndProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
             if (LOWORD(wParam) == IDC_BUTTON_NEXT)
             {
-               //TODO
-               /* handle next button */
+               INT CurSel;
+
+               /* retrieve current page */
+               CurSel = TabCtrl_GetCurSel(hTabCtrlWnd);
+               CurSel++;
+
+               /* enable/disable next button */
+               EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON_NEXT), 
+                            (CurSel != TabCtrl_GetItemCount(hTabCtrlWnd) - 1));
+               
+               /* switch to next page */
+               SendMessageW(hTabCtrlWnd, TCM_SETCURSEL, CurSel, 0L);
+                
                return TRUE;
             }
 
@@ -210,6 +220,12 @@ DxDiagWndProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
             pnmh = (LPNMHDR)lParam;
             if ((pnmh->hwndFrom == hTabCtrlWnd) && (pnmh->idFrom == IDC_TAB_CONTROL) && (pnmh->code == TCN_SELCHANGE))
             {
+               INT CurSel = TabCtrl_GetCurSel(hTabCtrlWnd);
+
+               /* enable/disable next button */
+               EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON_NEXT), 
+                            (CurSel != TabCtrl_GetItemCount(hTabCtrlWnd) - 1));
+
                 TabCtrl_OnSelChange(pContext);
             }
             break;
index 33c1f9d..311fc03 100644 (file)
@@ -17,7 +17,6 @@ GetRegValue(HKEY hBaseKey, LPWSTR SubKey, LPWSTR ValueName, DWORD Type, LPWSTR R
     DWORD dwType;
     DWORD dwSize;
 
-
     if (RegOpenKeyExW(hBaseKey, SubKey, 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
         return FALSE;
 
@@ -25,10 +24,10 @@ GetRegValue(HKEY hBaseKey, LPWSTR SubKey, LPWSTR ValueName, DWORD Type, LPWSTR R
     res = RegQueryValueExW(hKey, ValueName, NULL, &dwType, (LPBYTE)Result, &dwSize);
     RegCloseKey(hKey);
 
-    if (dwType != Type)
+    if (res != ERROR_SUCCESS)
         return FALSE;
 
-    if (res != ERROR_SUCCESS)
+       if (dwType != Type)
         return FALSE;
 
     if (Size == sizeof(DWORD))