From fa960bf57961b9b7b83bc60581a9dcb7ffbe4cc4 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 24 Dec 2012 10:51:02 +0000 Subject: [PATCH] [TASKMGR] 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 | 4 ++-- reactos/base/applications/taskmgr/column.c | 4 ++-- reactos/base/applications/taskmgr/graph.c | 2 +- reactos/base/applications/taskmgr/graphctl.c | 8 ++++---- reactos/base/applications/taskmgr/perfpage.c | 9 ++++----- reactos/base/applications/taskmgr/procpage.c | 2 +- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/reactos/base/applications/taskmgr/affinity.c b/reactos/base/applications/taskmgr/affinity.c index e3e2e0e28a3..1302835fa21 100644 --- a/reactos/base/applications/taskmgr/affinity.c +++ b/reactos/base/applications/taskmgr/affinity.c @@ -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); } diff --git a/reactos/base/applications/taskmgr/column.c b/reactos/base/applications/taskmgr/column.c index 3eb8a6d1519..27fb191ba13 100644 --- a/reactos/base/applications/taskmgr/column.c +++ b/reactos/base/applications/taskmgr/column.c @@ -172,7 +172,7 @@ ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) for (i=0; im_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 */ diff --git a/reactos/base/applications/taskmgr/perfpage.c b/reactos/base/applications/taskmgr/perfpage.c index 872a01406f9..959b60145fb 100644 --- a/reactos/base/applications/taskmgr/perfpage.c +++ b/reactos/base/applications/taskmgr/perfpage.c @@ -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: diff --git a/reactos/base/applications/taskmgr/procpage.c b/reactos/base/applications/taskmgr/procpage.c index 4695fb90321..153c1dc89f3 100644 --- a/reactos/base/applications/taskmgr/procpage.c +++ b/reactos/base/applications/taskmgr/procpage.c @@ -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 */