[TASKMGR]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Mon, 24 Dec 2012 10:51:02 +0000 (10:51 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Mon, 24 Dec 2012 10:51:02 +0000 (10:51 +0000)
1) Use of CheckDlgButton() and IsDlgButtonChecked() rather than SendMessage, it will improve code readability.
2)Removes an useless initialization into perfpage.c
3) GetWindowLong/SetWindowLong were replaced with GetWindowLongPtr/SetWindowLongPtr, but GWL_WNDPROC and GWL_ID were not with GWLP_WNDPROC and GWLP_ID.
4) Corrected some comment texts.
Patch by Carlo Bramini
CORE-6367 #resolve

svn path=/trunk/; revision=57989

reactos/base/applications/taskmgr/affinity.c
reactos/base/applications/taskmgr/column.c
reactos/base/applications/taskmgr/graph.c
reactos/base/applications/taskmgr/graphctl.c
reactos/base/applications/taskmgr/perfpage.c
reactos/base/applications/taskmgr/procpage.c

index e3e2e0e..1302835 100644 (file)
@@ -97,7 +97,7 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
              * has affinity with
              */
             if (dwProcessAffinityMask & (1 << nCpu))
-                SendMessageW(GetDlgItem(hDlg, dwCpuTable[nCpu]), BM_SETCHECK, BST_CHECKED, 0);
+                CheckDlgButton(hDlg, dwCpuTable[nCpu], BST_CHECKED);
         }
 
         return TRUE;
@@ -123,7 +123,7 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
                  * First we have to create a mask out of each
                  * checkbox that the user checked.
                  */
-                if (SendMessageW(GetDlgItem(hDlg, dwCpuTable[nCpu]), BM_GETCHECK, 0, 0))
+                if (IsDlgButtonChecked(hDlg, dwCpuTable[nCpu]))
                     dwProcessAffinityMask |= (1 << nCpu);
             }
 
index 3eb8a6d..27fb191 100644 (file)
@@ -172,7 +172,7 @@ ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
         for (i=0; i<COLUMN_NMAX; i++) {
             if (TaskManagerSettings.Columns[i])
-                SendMessageW(GetDlgItem(hDlg, ColumnPresets[i].dwIdcCtrl), BM_SETCHECK, BST_CHECKED, 0);
+                CheckDlgButton(hDlg, ColumnPresets[i].dwIdcCtrl, BST_CHECKED);
         }
         return TRUE;
 
@@ -187,7 +187,7 @@ ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
         if (LOWORD(wParam) == IDOK)
         {
             for (i=0; i<COLUMN_NMAX; i++)
-                TaskManagerSettings.Columns[i] = (BOOL) SendMessageW(GetDlgItem(hDlg, ColumnPresets[i].dwIdcCtrl), BM_GETCHECK, 0, 0);
+                TaskManagerSettings.Columns[i] = (BOOL)IsDlgButtonChecked(hDlg, ColumnPresets[i].dwIdcCtrl);
 
             EndDialog(hDlg, LOWORD(wParam));
             return TRUE;
index 10fae74..ffc7217 100644 (file)
@@ -102,7 +102,7 @@ Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
         hdc = BeginPaint(hWnd, &ps);
 
-        WindowId = GetWindowLongPtrW(hWnd, GWL_ID);
+        WindowId = GetWindowLongPtrW(hWnd, GWLP_ID);
 
         switch (WindowId)
         {
index 5735e8b..f303aa9 100644 (file)
@@ -59,7 +59,7 @@ static void GraphCtrl_Init(TGraphCtrl* this)
     this->m_nYDecimals = 3;
 
     /*  set some initial values for the scaling until "SetRange" is called.
-     *  these are protected varaibles and must be set with SetRange
+     *  these are protected variables and must be set with SetRange
      *  in order to ensure that m_dRange is updated accordingly
      */
     /*   m_dLowerLimit = -10.0; */
@@ -322,8 +322,8 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this, BOOL bResize)
             (m_rectPlot.bottom+m_rectPlot.top)/2, m_strYUnitsString, wcslen(m_strYUnitsString));
     SelectObject(m_dcGrid, oldFont);
 #endif
-    /*  at this point we are done filling the the grid bitmap,  */
-    /*  no more drawing to this bitmap is needed until the setting are changed */
+    /*  at this point we are done filling the grid bitmap,  */
+    /*  no more drawing to this bitmap is needed until the settings are changed */
 
     /*  if we don't have one yet, set up a memory dc for the plot */
     if (this->m_dcPlot == NULL)
@@ -441,7 +441,7 @@ void GraphCtrl_DrawPoint(TGraphCtrl* this)
         /*  fill the cleanup area with the background */
         FillRect(this->m_dcPlot, &rectCleanUp, this->m_brushBack);
 
-        /*  draw the next line segement */
+        /*  draw the next line segment */
         for (i = 0; i < MAX_PLOTS; i++)
         {
             /*  grab the plotting pen */
index 872a014..959b601 100644 (file)
@@ -91,7 +91,6 @@ void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference,
     } else {
         cx = rc.left + nXDifference;
         cy = rc.top + nYDifference;
-        sx = sy = 0;
         SetWindowPos(hCntrl, NULL, cx, cy, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
     }
     InvalidateRect(hCntrl, NULL, TRUE);
@@ -198,10 +197,10 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
         /*
          *  Subclass graph buttons
          */
-        OldGraphWndProc = (WNDPROC)(LONG_PTR) SetWindowLongPtrW(hPerformancePageCpuUsageGraph, GWL_WNDPROC, (LONG_PTR)Graph_WndProc);
-        SetWindowLongPtrW(hPerformancePageMemUsageGraph, GWL_WNDPROC, (LONG_PTR)Graph_WndProc);
-        OldGraphCtrlWndProc = (WNDPROC)(LONG_PTR) SetWindowLongPtrW(hPerformancePageMemUsageHistoryGraph, GWL_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
-        SetWindowLongPtrW(hPerformancePageCpuUsageHistoryGraph, GWL_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
+        OldGraphWndProc = (WNDPROC)(LONG_PTR) SetWindowLongPtrW(hPerformancePageCpuUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
+        SetWindowLongPtrW(hPerformancePageMemUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
+        OldGraphCtrlWndProc = (WNDPROC)(LONG_PTR) SetWindowLongPtrW(hPerformancePageMemUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
+        SetWindowLongPtrW(hPerformancePageCpuUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
         return TRUE;
 
     case WM_COMMAND:
index 4695fb9..153c1dc 100644 (file)
@@ -139,7 +139,7 @@ ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
         /*
          * Subclass the process list control so we can intercept WM_ERASEBKGND
          */
-        OldProcessListWndProc = (WNDPROC)(LONG_PTR) SetWindowLongPtrW(hProcessPageListCtrl, GWL_WNDPROC, (LONG_PTR)ProcessListWndProc);
+        OldProcessListWndProc = (WNDPROC)(LONG_PTR) SetWindowLongPtrW(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc);
 
 #ifdef RUN_PROC_PAGE
         /* Start our refresh thread */