6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 HWND hProcessPage
; /* Process List Property Page */
27 HWND hProcessPageListCtrl
; /* Process ListCtrl Window */
28 HWND hProcessPageHeaderCtrl
; /* Process Header Control */
29 HWND hProcessPageEndProcessButton
; /* Process End Process button */
30 HWND hProcessPageShowAllProcessesButton
;/* Process Show All Processes checkbox */
32 static int nProcessPageWidth
;
33 static int nProcessPageHeight
;
35 static HANDLE hProcessPageEvent
= NULL
; /* When this event becomes signaled then we refresh the process list */
37 void ProcessPageOnNotify(WPARAM wParam
, LPARAM lParam
);
38 void CommaSeparateNumberString(LPTSTR strNumber
, int nMaxCount
);
39 void ProcessPageShowContextMenu(DWORD dwProcessId
);
40 DWORD WINAPI
ProcessPageRefreshThread(void *lpParameter
);
43 ProcessPageWndProc(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
)
53 * Save the width and height
55 GetClientRect(hDlg
, &rc
);
56 nProcessPageWidth
= rc
.right
;
57 nProcessPageHeight
= rc
.bottom
;
59 /* Update window position */
60 SetWindowPos(hDlg
, NULL
, 15, 30, 0, 0, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOSIZE
|SWP_NOZORDER
);
63 * Get handles to the controls
65 hProcessPageListCtrl
= GetDlgItem(hDlg
, IDC_PROCESSLIST
);
66 hProcessPageHeaderCtrl
= ListView_GetHeader(hProcessPageListCtrl
);
67 hProcessPageEndProcessButton
= GetDlgItem(hDlg
, IDC_ENDPROCESS
);
68 hProcessPageShowAllProcessesButton
= GetDlgItem(hDlg
, IDC_SHOWALLPROCESSES
);
71 * Set the font, title, and extended window styles for the list control
73 SendMessage(hProcessPageListCtrl
, WM_SETFONT
, SendMessage(hProcessPage
, WM_GETFONT
, 0, 0), TRUE
);
74 SetWindowText(hProcessPageListCtrl
, _T("Processes"));
75 (void)ListView_SetExtendedListViewStyle(hProcessPageListCtrl
, ListView_GetExtendedListViewStyle(hProcessPageListCtrl
) | LVS_EX_FULLROWSELECT
| LVS_EX_HEADERDRAGDROP
);
80 * Subclass the process list control so we can intercept WM_ERASEBKGND
82 OldProcessListWndProc
= (WNDPROC
)SetWindowLongPtr(hProcessPageListCtrl
, GWL_WNDPROC
, (DWORD_PTR
)ProcessListWndProc
);
84 /* Start our refresh thread */
85 CreateThread(NULL
, 0, ProcessPageRefreshThread
, NULL
, 0, NULL
);
90 /* Close the event handle, this will make the */
91 /* refresh thread exit when the wait fails */
92 CloseHandle(hProcessPageEvent
);
99 /* Handle the button clicks */
100 switch (LOWORD(wParam
))
103 ProcessPage_OnEndProcess();
108 if (wParam
== SIZE_MINIMIZED
)
113 nXDifference
= cx
- nProcessPageWidth
;
114 nYDifference
= cy
- nProcessPageHeight
;
115 nProcessPageWidth
= cx
;
116 nProcessPageHeight
= cy
;
118 /* Reposition the application page's controls */
119 GetWindowRect(hProcessPageListCtrl
, &rc
);
120 cx
= (rc
.right
- rc
.left
) + nXDifference
;
121 cy
= (rc
.bottom
- rc
.top
) + nYDifference
;
122 SetWindowPos(hProcessPageListCtrl
, NULL
, 0, 0, cx
, cy
, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOMOVE
|SWP_NOZORDER
);
123 InvalidateRect(hProcessPageListCtrl
, NULL
, TRUE
);
125 GetClientRect(hProcessPageEndProcessButton
, &rc
);
126 MapWindowPoints(hProcessPageEndProcessButton
, hDlg
, (LPPOINT
)(PRECT
)(&rc
), (sizeof(RECT
)/sizeof(POINT
)) );
127 cx
= rc
.left
+ nXDifference
;
128 cy
= rc
.top
+ nYDifference
;
129 SetWindowPos(hProcessPageEndProcessButton
, NULL
, cx
, cy
, 0, 0, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOSIZE
|SWP_NOZORDER
);
130 InvalidateRect(hProcessPageEndProcessButton
, NULL
, TRUE
);
132 GetClientRect(hProcessPageShowAllProcessesButton
, &rc
);
133 MapWindowPoints(hProcessPageShowAllProcessesButton
, hDlg
, (LPPOINT
)(PRECT
)(&rc
), (sizeof(RECT
)/sizeof(POINT
)) );
135 cy
= rc
.top
+ nYDifference
;
136 SetWindowPos(hProcessPageShowAllProcessesButton
, NULL
, cx
, cy
, 0, 0, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOSIZE
|SWP_NOZORDER
);
137 InvalidateRect(hProcessPageShowAllProcessesButton
, NULL
, TRUE
);
143 ProcessPageOnNotify(wParam
, lParam
);
150 void ProcessPageOnNotify(WPARAM wParam
, LPARAM lParam
)
160 IO_COUNTERS iocounters
;
163 idctrl
= (int) wParam
;
164 pnmh
= (LPNMHDR
) lParam
;
165 pnmv
= (LPNMLISTVIEW
) lParam
;
166 pnmdi
= (NMLVDISPINFO
*) lParam
;
167 pnmhdr
= (LPNMHEADER
) lParam
;
169 if (pnmh
->hwndFrom
== hProcessPageListCtrl
)
174 case LVN_ITEMCHANGED
:
179 case LVN_GETDISPINFO
:
181 if (!(pnmdi
->item
.mask
& LVIF_TEXT
))
184 ColumnIndex
= pnmdi
->item
.iSubItem
;
185 Index
= pnmdi
->item
.iItem
;
187 if (ColumnDataHints
[ColumnIndex
] == COLUMN_IMAGENAME
)
188 PerfDataGetImageName(Index
, pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
189 if (ColumnDataHints
[ColumnIndex
] == COLUMN_PID
)
190 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetProcessId(Index
));
191 if (ColumnDataHints
[ColumnIndex
] == COLUMN_USERNAME
)
192 PerfDataGetUserName(Index
, pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
193 if (ColumnDataHints
[ColumnIndex
] == COLUMN_SESSIONID
)
194 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetSessionId(Index
));
195 if (ColumnDataHints
[ColumnIndex
] == COLUMN_CPUUSAGE
)
196 wsprintf(pnmdi
->item
.pszText
, _T("%02d"), PerfDataGetCPUUsage(Index
));
197 if (ColumnDataHints
[ColumnIndex
] == COLUMN_CPUTIME
)
203 time
= PerfDataGetCPUTime(Index
);
205 dwHours
= (DWORD
)(time
.QuadPart
/ 36000000000L);
206 dwMinutes
= (DWORD
)((time
.QuadPart
% 36000000000L) / 600000000L);
207 dwSeconds
= (DWORD
)(((time
.QuadPart
% 36000000000L) % 600000000L) / 10000000L);
209 dwHours
= (DWORD
)(time
.QuadPart
/ 36000000000LL);
210 dwMinutes
= (DWORD
)((time
.QuadPart
% 36000000000LL) / 600000000LL);
211 dwSeconds
= (DWORD
)(((time
.QuadPart
% 36000000000LL) % 600000000LL) / 10000000LL);
213 wsprintf(pnmdi
->item
.pszText
, _T("%d:%02d:%02d"), dwHours
, dwMinutes
, dwSeconds
);
215 if (ColumnDataHints
[ColumnIndex
] == COLUMN_MEMORYUSAGE
)
217 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetWorkingSetSizeBytes(Index
) / 1024);
218 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
219 _tcscat(pnmdi
->item
.pszText
, _T(" K"));
221 if (ColumnDataHints
[ColumnIndex
] == COLUMN_PEAKMEMORYUSAGE
)
223 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetPeakWorkingSetSizeBytes(Index
) / 1024);
224 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
225 _tcscat(pnmdi
->item
.pszText
, _T(" K"));
227 if (ColumnDataHints
[ColumnIndex
] == COLUMN_MEMORYUSAGEDELTA
)
229 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetWorkingSetSizeDelta(Index
) / 1024);
230 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
231 _tcscat(pnmdi
->item
.pszText
, _T(" K"));
233 if (ColumnDataHints
[ColumnIndex
] == COLUMN_PAGEFAULTS
)
235 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetPageFaultCount(Index
));
236 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
238 if (ColumnDataHints
[ColumnIndex
] == COLUMN_PAGEFAULTSDELTA
)
240 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetPageFaultCountDelta(Index
));
241 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
243 if (ColumnDataHints
[ColumnIndex
] == COLUMN_VIRTUALMEMORYSIZE
)
245 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetVirtualMemorySizeBytes(Index
) / 1024);
246 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
247 _tcscat(pnmdi
->item
.pszText
, _T(" K"));
249 if (ColumnDataHints
[ColumnIndex
] == COLUMN_PAGEDPOOL
)
251 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetPagedPoolUsagePages(Index
) / 1024);
252 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
253 _tcscat(pnmdi
->item
.pszText
, _T(" K"));
255 if (ColumnDataHints
[ColumnIndex
] == COLUMN_NONPAGEDPOOL
)
257 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetNonPagedPoolUsagePages(Index
) / 1024);
258 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
259 _tcscat(pnmdi
->item
.pszText
, _T(" K"));
261 if (ColumnDataHints
[ColumnIndex
] == COLUMN_BASEPRIORITY
)
262 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetBasePriority(Index
));
263 if (ColumnDataHints
[ColumnIndex
] == COLUMN_HANDLECOUNT
)
265 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetHandleCount(Index
));
266 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
268 if (ColumnDataHints
[ColumnIndex
] == COLUMN_THREADCOUNT
)
270 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetThreadCount(Index
));
271 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
273 if (ColumnDataHints
[ColumnIndex
] == COLUMN_USEROBJECTS
)
275 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetUSERObjectCount(Index
));
276 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
278 if (ColumnDataHints
[ColumnIndex
] == COLUMN_GDIOBJECTS
)
280 wsprintf(pnmdi
->item
.pszText
, _T("%d"), PerfDataGetGDIObjectCount(Index
));
281 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
283 if (ColumnDataHints
[ColumnIndex
] == COLUMN_IOREADS
)
285 PerfDataGetIOCounters(Index
, &iocounters
);
286 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadOperationCount); */
288 #define _ui64toa _ui64tow
291 _ui64toa(iocounters
.ReadOperationCount
, pnmdi
->item
.pszText
, 10);
292 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
294 if (ColumnDataHints
[ColumnIndex
] == COLUMN_IOWRITES
)
296 PerfDataGetIOCounters(Index
, &iocounters
);
297 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteOperationCount); */
298 _ui64toa(iocounters
.WriteOperationCount
, pnmdi
->item
.pszText
, 10);
299 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
301 if (ColumnDataHints
[ColumnIndex
] == COLUMN_IOOTHER
)
303 PerfDataGetIOCounters(Index
, &iocounters
);
304 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherOperationCount); */
305 _ui64toa(iocounters
.OtherOperationCount
, pnmdi
->item
.pszText
, 10);
306 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
308 if (ColumnDataHints
[ColumnIndex
] == COLUMN_IOREADBYTES
)
310 PerfDataGetIOCounters(Index
, &iocounters
);
311 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadTransferCount); */
312 _ui64toa(iocounters
.ReadTransferCount
, pnmdi
->item
.pszText
, 10);
313 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
315 if (ColumnDataHints
[ColumnIndex
] == COLUMN_IOWRITEBYTES
)
317 PerfDataGetIOCounters(Index
, &iocounters
);
318 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteTransferCount); */
319 _ui64toa(iocounters
.WriteTransferCount
, pnmdi
->item
.pszText
, 10);
320 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
322 if (ColumnDataHints
[ColumnIndex
] == COLUMN_IOOTHERBYTES
)
324 PerfDataGetIOCounters(Index
, &iocounters
);
325 /* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherTransferCount); */
326 _ui64toa(iocounters
.OtherTransferCount
, pnmdi
->item
.pszText
, 10);
327 CommaSeparateNumberString(pnmdi
->item
.pszText
, pnmdi
->item
.cchTextMax
);
334 for (Index
=0; Index
<(ULONG
)ListView_GetItemCount(hProcessPageListCtrl
); Index
++)
336 memset(&lvitem
, 0, sizeof(LVITEM
));
338 lvitem
.mask
= LVIF_STATE
;
339 lvitem
.stateMask
= LVIS_SELECTED
;
340 lvitem
.iItem
= Index
;
342 (void)ListView_GetItem(hProcessPageListCtrl
, &lvitem
);
344 if (lvitem
.state
& LVIS_SELECTED
)
348 if ((ListView_GetSelectedCount(hProcessPageListCtrl
) == 1) &&
349 (PerfDataGetProcessId(Index
) != 0))
351 ProcessPageShowContextMenu(PerfDataGetProcessId(Index
));
358 else if (pnmh
->hwndFrom
== hProcessPageHeaderCtrl
)
365 * FIXME: Fix the column sorting
367 *ListView_SortItems(hApplicationPageListCtrl, ApplicationPageCompareFunc, NULL);
368 *bSortAscending = !bSortAscending;
373 case HDN_ITEMCHANGED
:
375 UpdateColumnDataHints();
381 UpdateColumnDataHints();
390 void CommaSeparateNumberString(LPTSTR strNumber
, int nMaxCount
)
395 for (i
=0,j
=0; i
<(_tcslen(strNumber
) % 3); i
++, j
++)
396 temp
[j
] = strNumber
[i
];
397 for (k
=0; i
<_tcslen(strNumber
); i
++,j
++,k
++) {
398 if ((k
% 3 == 0) && (j
> 0))
400 temp
[j
] = strNumber
[i
];
403 _tcsncpy(strNumber
, temp
, nMaxCount
);
406 void ProcessPageShowContextMenu(DWORD dwProcessId
)
414 DWORD dwProcessPriorityClass
;
415 TCHAR strDebugger
[260];
416 DWORD dwDebuggerSize
;
420 memset(&si
, 0, sizeof(SYSTEM_INFO
));
425 hMenu
= LoadMenu(hInst
, MAKEINTRESOURCE(IDR_PROCESS_PAGE_CONTEXT
));
426 hSubMenu
= GetSubMenu(hMenu
, 0);
427 hPriorityMenu
= GetSubMenu(hSubMenu
, 4);
429 hProcess
= OpenProcess(PROCESS_QUERY_INFORMATION
, FALSE
, dwProcessId
);
430 dwProcessPriorityClass
= GetPriorityClass(hProcess
);
431 CloseHandle(hProcess
);
433 if (si
.dwNumberOfProcessors
< 2)
434 RemoveMenu(hSubMenu
, ID_PROCESS_PAGE_SETAFFINITY
, MF_BYCOMMAND
);
436 if (!DebugChannelsAreSupported())
437 RemoveMenu(hSubMenu
, ID_PROCESS_PAGE_DEBUGCHANNELS
, MF_BYCOMMAND
);
439 switch (dwProcessPriorityClass
) {
440 case REALTIME_PRIORITY_CLASS
:
441 CheckMenuRadioItem(hPriorityMenu
, ID_PROCESS_PAGE_SETPRIORITY_REALTIME
, ID_PROCESS_PAGE_SETPRIORITY_LOW
, ID_PROCESS_PAGE_SETPRIORITY_REALTIME
, MF_BYCOMMAND
);
443 case HIGH_PRIORITY_CLASS
:
444 CheckMenuRadioItem(hPriorityMenu
, ID_PROCESS_PAGE_SETPRIORITY_REALTIME
, ID_PROCESS_PAGE_SETPRIORITY_LOW
, ID_PROCESS_PAGE_SETPRIORITY_HIGH
, MF_BYCOMMAND
);
446 case ABOVE_NORMAL_PRIORITY_CLASS
:
447 CheckMenuRadioItem(hPriorityMenu
, ID_PROCESS_PAGE_SETPRIORITY_REALTIME
, ID_PROCESS_PAGE_SETPRIORITY_LOW
, ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL
, MF_BYCOMMAND
);
449 case NORMAL_PRIORITY_CLASS
:
450 CheckMenuRadioItem(hPriorityMenu
, ID_PROCESS_PAGE_SETPRIORITY_REALTIME
, ID_PROCESS_PAGE_SETPRIORITY_LOW
, ID_PROCESS_PAGE_SETPRIORITY_NORMAL
, MF_BYCOMMAND
);
452 case BELOW_NORMAL_PRIORITY_CLASS
:
453 CheckMenuRadioItem(hPriorityMenu
, ID_PROCESS_PAGE_SETPRIORITY_REALTIME
, ID_PROCESS_PAGE_SETPRIORITY_LOW
, ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL
, MF_BYCOMMAND
);
455 case IDLE_PRIORITY_CLASS
:
456 CheckMenuRadioItem(hPriorityMenu
, ID_PROCESS_PAGE_SETPRIORITY_REALTIME
, ID_PROCESS_PAGE_SETPRIORITY_LOW
, ID_PROCESS_PAGE_SETPRIORITY_LOW
, MF_BYCOMMAND
);
460 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE
, _T("Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug"), 0, KEY_READ
, &hKey
) == ERROR_SUCCESS
)
462 dwDebuggerSize
= 260;
463 if (RegQueryValueEx(hKey
, _T("Debugger"), NULL
, NULL
, (LPBYTE
)strDebugger
, &dwDebuggerSize
) == ERROR_SUCCESS
)
465 for (Idx
=0; Idx
<_tcslen(strDebugger
); Idx
++)
466 strDebugger
[Idx
] = toupper(strDebugger
[Idx
]);
468 if (_tcsstr(strDebugger
, _T("DRWTSN32")))
469 EnableMenuItem(hSubMenu
, ID_PROCESS_PAGE_DEBUG
, MF_BYCOMMAND
|MF_DISABLED
|MF_GRAYED
);
472 EnableMenuItem(hSubMenu
, ID_PROCESS_PAGE_DEBUG
, MF_BYCOMMAND
|MF_DISABLED
|MF_GRAYED
);
476 EnableMenuItem(hSubMenu
, ID_PROCESS_PAGE_DEBUG
, MF_BYCOMMAND
|MF_DISABLED
|MF_GRAYED
);
478 TrackPopupMenu(hSubMenu
, TPM_LEFTALIGN
|TPM_TOPALIGN
|TPM_LEFTBUTTON
, pt
.x
, pt
.y
, 0, hMainWnd
, NULL
);
482 void RefreshProcessPage(void)
484 /* Signal the event so that our refresh thread */
485 /* will wake up and refresh the process page */
486 SetEvent(hProcessPageEvent
);
489 DWORD WINAPI
ProcessPageRefreshThread(void *lpParameter
)
491 ULONG OldProcessorUsage
= 0;
492 ULONG OldProcessCount
= 0;
493 TCHAR szCpuUsage
[256], szProcesses
[256];
495 /* Create the event */
496 hProcessPageEvent
= CreateEvent(NULL
, TRUE
, TRUE
, NULL
);
498 /* If we couldn't create the event then exit the thread */
499 if (!hProcessPageEvent
)
502 LoadString(hInst
, IDS_STATUS_CPUUSAGE
, szCpuUsage
, 256);
503 LoadString(hInst
, IDS_STATUS_PROCESSES
, szProcesses
, 256);
508 /* Wait on the event */
509 dwWaitVal
= WaitForSingleObject(hProcessPageEvent
, INFINITE
);
511 /* If the wait failed then the event object must have been */
512 /* closed and the task manager is exiting so exit this thread */
513 if (dwWaitVal
== WAIT_FAILED
)
516 if (dwWaitVal
== WAIT_OBJECT_0
) {
519 /* Reset our event */
520 ResetEvent(hProcessPageEvent
);
522 if ((ULONG
)SendMessage(hProcessPageListCtrl
, LVM_GETITEMCOUNT
, 0, 0) != PerfDataGetProcessCount())
523 SendMessage(hProcessPageListCtrl
, LVM_SETITEMCOUNT
, PerfDataGetProcessCount(), /*LVSICF_NOINVALIDATEALL|*/LVSICF_NOSCROLL
);
525 if (IsWindowVisible(hProcessPage
))
526 InvalidateRect(hProcessPageListCtrl
, NULL
, FALSE
);
528 if (OldProcessorUsage
!= PerfDataGetProcessorUsage()) {
529 OldProcessorUsage
= PerfDataGetProcessorUsage();
530 wsprintf(text
, szCpuUsage
, OldProcessorUsage
);
531 SendMessage(hStatusWnd
, SB_SETTEXT
, 1, (LPARAM
)text
);
533 if (OldProcessCount
!= PerfDataGetProcessCount()) {
534 OldProcessCount
= PerfDataGetProcessCount();
535 wsprintf(text
, szProcesses
, OldProcessCount
);
536 SendMessage(hStatusWnd
, SB_SETTEXT
, 0, (LPARAM
)text
);