[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
This commit is contained in:
Timo Kreuzer 2012-12-24 10:51:02 +00:00
parent 8a09fb755c
commit fa960bf579
6 changed files with 14 additions and 15 deletions

View 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);
}

View 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;

View 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)
{

View 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 */

View 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:

View 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 */