6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
7 * Copyright (C) 2008 Vladimir Pankratov
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
32 #include "wine/unicode.h"
37 TGraphCtrl PerformancePageCpuUsageHistoryGraph
;
38 TGraphCtrl PerformancePageMemUsageHistoryGraph
;
40 HWND hPerformancePage
; /* Performance Property Page */
41 HWND hPerformancePageCpuUsageGraph
; /* CPU Usage Graph */
42 HWND hPerformancePageMemUsageGraph
; /* MEM Usage Graph */
43 HWND hPerformancePageCpuUsageHistoryGraph
; /* CPU Usage History Graph */
44 HWND hPerformancePageMemUsageHistoryGraph
; /* Memory Usage History Graph */
45 HWND hPerformancePageTotalsFrame
; /* Totals Frame */
46 HWND hPerformancePageCommitChargeFrame
; /* Commit Charge Frame */
47 HWND hPerformancePageKernelMemoryFrame
; /* Kernel Memory Frame */
48 HWND hPerformancePagePhysicalMemoryFrame
; /* Physical Memory Frame */
49 HWND hPerformancePageCpuUsageFrame
;
50 HWND hPerformancePageMemUsageFrame
;
51 HWND hPerformancePageCpuUsageHistoryFrame
;
52 HWND hPerformancePageMemUsageHistoryFrame
;
53 HWND hPerformancePageCommitChargeTotalEdit
; /* Commit Charge Total Edit Control */
54 HWND hPerformancePageCommitChargeLimitEdit
; /* Commit Charge Limit Edit Control */
55 HWND hPerformancePageCommitChargePeakEdit
; /* Commit Charge Peak Edit Control */
56 HWND hPerformancePageKernelMemoryTotalEdit
; /* Kernel Memory Total Edit Control */
57 HWND hPerformancePageKernelMemoryPagedEdit
; /* Kernel Memory Paged Edit Control */
58 HWND hPerformancePageKernelMemoryNonPagedEdit
; /* Kernel Memory NonPaged Edit Control */
59 HWND hPerformancePagePhysicalMemoryTotalEdit
; /* Physical Memory Total Edit Control */
60 HWND hPerformancePagePhysicalMemoryAvailableEdit
; /* Physical Memory Available Edit Control */
61 HWND hPerformancePagePhysicalMemorySystemCacheEdit
; /* Physical Memory System Cache Edit Control */
62 HWND hPerformancePageTotalsHandleCountEdit
; /* Total Handles Edit Control */
63 HWND hPerformancePageTotalsProcessCountEdit
; /* Total Processes Edit Control */
64 HWND hPerformancePageTotalsThreadCountEdit
; /* Total Threads Edit Control */
67 static int nPerformancePageWidth
;
68 static int nPerformancePageHeight
;
69 static HANDLE hPerformancePageEvent
= NULL
; /* When this event becomes signaled then we refresh the performance page */
71 static void AdjustFrameSize(HWND hCntrl
, HWND hDlg
, int nXDifference
, int nYDifference
, int pos
)
76 GetClientRect(hCntrl
, &rc
);
77 MapWindowPoints(hCntrl
, hDlg
, (LPPOINT
)(&rc
), (sizeof(RECT
)/sizeof(POINT
)));
81 sx
= rc
.right
- rc
.left
;
86 cy
+= nYDifference
/ 2;
92 cy
+= nYDifference
/ 2;
96 sy
= rc
.bottom
- rc
.top
+ nYDifference
/ 2;
97 SetWindowPos(hCntrl
, NULL
, cx
, cy
, sx
, sy
, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOZORDER
);
99 cx
= rc
.left
+ nXDifference
;
100 cy
= rc
.top
+ nYDifference
;
101 SetWindowPos(hCntrl
, NULL
, cx
, cy
, 0, 0, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOSIZE
|SWP_NOZORDER
);
103 InvalidateRect(hCntrl
, NULL
, TRUE
);
106 static void AdjustControlPostion(HWND hCntrl
, HWND hDlg
, int nXDifference
, int nYDifference
)
108 AdjustFrameSize(hCntrl
, hDlg
, nXDifference
, nYDifference
, 0);
111 static void AdjustCntrlPos(int ctrl_id
, HWND hDlg
, int nXDifference
, int nYDifference
)
113 AdjustFrameSize(GetDlgItem(hDlg
, ctrl_id
), hDlg
, nXDifference
, nYDifference
, 0);
115 void RefreshPerformancePage(void)
117 /* Signal the event so that our refresh thread */
118 /* will wake up and refresh the performance page */
119 SetEvent(hPerformancePageEvent
);
122 static DWORD WINAPI
PerformancePageRefreshThread(void *lpParameter
)
124 ULONG CommitChargeTotal
;
125 ULONG CommitChargeLimit
;
126 ULONG CommitChargePeak
;
128 ULONG KernelMemoryTotal
;
129 ULONG KernelMemoryPaged
;
130 ULONG KernelMemoryNonPaged
;
132 ULONG PhysicalMemoryTotal
;
133 ULONG PhysicalMemoryAvailable
;
134 ULONG PhysicalMemorySystemCache
;
138 ULONG TotalProcesses
;
142 static const WCHAR wszFormatDigit
[] = {'%','u',0};
143 WCHAR wszMemUsage
[255];
145 LoadStringW(hInst
, IDS_STATUS_BAR_MEMORY_USAGE
, wszMemUsage
, sizeof(wszMemUsage
)/sizeof(WCHAR
));
147 /* Create the event */
148 hPerformancePageEvent
= CreateEventW(NULL
, TRUE
, TRUE
, NULL
);
150 /* If we couldn't create the event then exit the thread */
151 if (!hPerformancePageEvent
)
158 /* Wait on the event */
159 dwWaitVal
= WaitForSingleObject(hPerformancePageEvent
, INFINITE
);
161 /* If the wait failed then the event object must have been */
162 /* closed and the task manager is exiting so exit this thread */
163 if (dwWaitVal
== WAIT_FAILED
)
166 if (dwWaitVal
== WAIT_OBJECT_0
)
169 ULONG CpuKernelUsage
;
170 int nBarsUsed1
, nBarsUsed2
;
173 /* Reset our event */
174 ResetEvent(hPerformancePageEvent
);
177 * Update the commit charge info
179 CommitChargeTotal
= PerfDataGetCommitChargeTotalK();
180 CommitChargeLimit
= PerfDataGetCommitChargeLimitK();
181 CommitChargePeak
= PerfDataGetCommitChargePeakK();
182 wsprintfW(Text
, wszFormatDigit
, CommitChargeTotal
);
183 SetWindowTextW(hPerformancePageCommitChargeTotalEdit
, Text
);
184 wsprintfW(Text
, wszFormatDigit
, CommitChargeLimit
);
185 SetWindowTextW(hPerformancePageCommitChargeLimitEdit
, Text
);
186 wsprintfW(Text
, wszFormatDigit
, CommitChargePeak
);
188 SetWindowTextW(hPerformancePageCommitChargePeakEdit
, Text
);
190 args
[0] = CommitChargeTotal
;
191 args
[1] = CommitChargeLimit
;
192 FormatMessageW(FORMAT_MESSAGE_FROM_STRING
|FORMAT_MESSAGE_ARGUMENT_ARRAY
,
193 wszMemUsage
, 0, 0, Text
,
194 sizeof(Text
)/sizeof(*Text
), (__ms_va_list
*)args
);
195 SendMessageW(hStatusWnd
, SB_SETTEXTW
, 2, (LPARAM
)Text
);
198 * Update the kernel memory info
200 KernelMemoryTotal
= PerfDataGetKernelMemoryTotalK();
201 KernelMemoryPaged
= PerfDataGetKernelMemoryPagedK();
202 KernelMemoryNonPaged
= PerfDataGetKernelMemoryNonPagedK();
203 wsprintfW(Text
, wszFormatDigit
, KernelMemoryTotal
);
204 SetWindowTextW(hPerformancePageKernelMemoryTotalEdit
, Text
);
205 wsprintfW(Text
, wszFormatDigit
, KernelMemoryPaged
);
206 SetWindowTextW(hPerformancePageKernelMemoryPagedEdit
, Text
);
207 wsprintfW(Text
, wszFormatDigit
, KernelMemoryNonPaged
);
208 SetWindowTextW(hPerformancePageKernelMemoryNonPagedEdit
, Text
);
211 * Update the physical memory info
213 PhysicalMemoryTotal
= PerfDataGetPhysicalMemoryTotalK();
214 PhysicalMemoryAvailable
= PerfDataGetPhysicalMemoryAvailableK();
215 PhysicalMemorySystemCache
= PerfDataGetPhysicalMemorySystemCacheK();
216 wsprintfW(Text
, wszFormatDigit
, PhysicalMemoryTotal
);
217 SetWindowTextW(hPerformancePagePhysicalMemoryTotalEdit
, Text
);
218 wsprintfW(Text
, wszFormatDigit
, PhysicalMemoryAvailable
);
219 SetWindowTextW(hPerformancePagePhysicalMemoryAvailableEdit
, Text
);
220 wsprintfW(Text
, wszFormatDigit
, PhysicalMemorySystemCache
);
221 SetWindowTextW(hPerformancePagePhysicalMemorySystemCacheEdit
, Text
);
224 * Update the totals info
226 TotalHandles
= PerfDataGetSystemHandleCount();
227 TotalThreads
= PerfDataGetTotalThreadCount();
228 TotalProcesses
= PerfDataGetProcessCount();
229 wsprintfW(Text
, wszFormatDigit
, TotalHandles
);
230 SetWindowTextW(hPerformancePageTotalsHandleCountEdit
, Text
);
231 wsprintfW(Text
, wszFormatDigit
, TotalThreads
);
232 SetWindowTextW(hPerformancePageTotalsThreadCountEdit
, Text
);
233 wsprintfW(Text
, wszFormatDigit
, TotalProcesses
);
234 SetWindowTextW(hPerformancePageTotalsProcessCountEdit
, Text
);
239 InvalidateRect(hPerformancePageCpuUsageGraph
, NULL
, FALSE
);
240 InvalidateRect(hPerformancePageMemUsageGraph
, NULL
, FALSE
);
245 CpuUsage
= PerfDataGetProcessorUsage();
246 CpuKernelUsage
= PerfDataGetProcessorSystemUsage();
249 * Get the memory usage
251 CommitChargeTotal
= (ULONGLONG
)PerfDataGetCommitChargeTotalK();
252 CommitChargeLimit
= (ULONGLONG
)PerfDataGetCommitChargeLimitK();
253 nBarsUsed1
= CommitChargeLimit
? ((CommitChargeTotal
* 100) / CommitChargeLimit
) : 0;
255 PhysicalMemoryTotal
= PerfDataGetPhysicalMemoryTotalK();
256 PhysicalMemoryAvailable
= PerfDataGetPhysicalMemoryAvailableK();
257 nBarsUsed2
= PhysicalMemoryTotal
? ((PhysicalMemoryAvailable
* 100) / PhysicalMemoryTotal
) : 0;
260 GraphCtrl_AppendPoint(&PerformancePageCpuUsageHistoryGraph
, CpuUsage
, CpuKernelUsage
, 0.0, 0.0);
261 GraphCtrl_AppendPoint(&PerformancePageMemUsageHistoryGraph
, nBarsUsed1
, nBarsUsed2
, 0.0, 0.0);
262 /* PerformancePageMemUsageHistoryGraph.SetRange(0.0, 100.0, 10) ; */
263 InvalidateRect(hPerformancePageMemUsageHistoryGraph
, NULL
, FALSE
);
264 InvalidateRect(hPerformancePageCpuUsageHistoryGraph
, NULL
, FALSE
);
271 PerformancePageWndProc(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
)
278 /* PAINTSTRUCT ps; */
283 /* Save the width and height */
284 GetClientRect(hDlg
, &rc
);
285 nPerformancePageWidth
= rc
.right
;
286 nPerformancePageHeight
= rc
.bottom
;
288 /* Update window position */
289 SetWindowPos(hDlg
, NULL
, 15, 30, 0, 0, SWP_NOACTIVATE
|SWP_NOOWNERZORDER
|SWP_NOSIZE
|SWP_NOZORDER
);
292 * Get handles to all the controls
294 hPerformancePageTotalsFrame
= GetDlgItem(hDlg
, IDC_TOTALS_FRAME
);
295 hPerformancePageCommitChargeFrame
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_FRAME
);
296 hPerformancePageKernelMemoryFrame
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_FRAME
);
297 hPerformancePagePhysicalMemoryFrame
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_FRAME
);
299 hPerformancePageCpuUsageFrame
= GetDlgItem(hDlg
, IDC_CPU_USAGE_FRAME
);
300 hPerformancePageMemUsageFrame
= GetDlgItem(hDlg
, IDC_MEM_USAGE_FRAME
);
301 hPerformancePageCpuUsageHistoryFrame
= GetDlgItem(hDlg
, IDC_CPU_USAGE_HISTORY_FRAME
);
302 hPerformancePageMemUsageHistoryFrame
= GetDlgItem(hDlg
, IDC_MEMORY_USAGE_HISTORY_FRAME
);
304 hPerformancePageCommitChargeTotalEdit
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_TOTAL
);
305 hPerformancePageCommitChargeLimitEdit
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_LIMIT
);
306 hPerformancePageCommitChargePeakEdit
= GetDlgItem(hDlg
, IDC_COMMIT_CHARGE_PEAK
);
307 hPerformancePageKernelMemoryTotalEdit
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_TOTAL
);
308 hPerformancePageKernelMemoryPagedEdit
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_PAGED
);
309 hPerformancePageKernelMemoryNonPagedEdit
= GetDlgItem(hDlg
, IDC_KERNEL_MEMORY_NONPAGED
);
310 hPerformancePagePhysicalMemoryTotalEdit
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_TOTAL
);
311 hPerformancePagePhysicalMemoryAvailableEdit
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_AVAILABLE
);
312 hPerformancePagePhysicalMemorySystemCacheEdit
= GetDlgItem(hDlg
, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE
);
313 hPerformancePageTotalsHandleCountEdit
= GetDlgItem(hDlg
, IDC_TOTALS_HANDLE_COUNT
);
314 hPerformancePageTotalsProcessCountEdit
= GetDlgItem(hDlg
, IDC_TOTALS_PROCESS_COUNT
);
315 hPerformancePageTotalsThreadCountEdit
= GetDlgItem(hDlg
, IDC_TOTALS_THREAD_COUNT
);
317 hPerformancePageCpuUsageGraph
= GetDlgItem(hDlg
, IDC_CPU_USAGE_GRAPH
);
318 hPerformancePageMemUsageGraph
= GetDlgItem(hDlg
, IDC_MEM_USAGE_GRAPH
);
319 hPerformancePageMemUsageHistoryGraph
= GetDlgItem(hDlg
, IDC_MEM_USAGE_HISTORY_GRAPH
);
320 hPerformancePageCpuUsageHistoryGraph
= GetDlgItem(hDlg
, IDC_CPU_USAGE_HISTORY_GRAPH
);
322 GetClientRect(hPerformancePageCpuUsageHistoryGraph
, &rc
);
323 /* create the control */
324 /* PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); */
325 GraphCtrl_Create(&PerformancePageCpuUsageHistoryGraph
, hPerformancePageCpuUsageHistoryGraph
, hDlg
, IDC_CPU_USAGE_HISTORY_GRAPH
);
326 /* customize the control */
327 GraphCtrl_SetRange(&PerformancePageCpuUsageHistoryGraph
, 0.0, 100.0, 10);
328 /* PerformancePageCpuUsageHistoryGraph.SetYUnits("Current") ; */
329 /* PerformancePageCpuUsageHistoryGraph.SetXUnits("Samples (Windows Timer: 100 msec)") ; */
330 /* PerformancePageCpuUsageHistoryGraph.SetBackgroundColor(RGB(0, 0, 64)) ; */
331 /* PerformancePageCpuUsageHistoryGraph.SetGridColor(RGB(192, 192, 255)) ; */
332 /* PerformancePageCpuUsageHistoryGraph.SetPlotColor(RGB(255, 255, 255)) ; */
333 GraphCtrl_SetBackgroundColor(&PerformancePageCpuUsageHistoryGraph
, RGB(0, 0, 0)) ;
334 GraphCtrl_SetGridColor(&PerformancePageCpuUsageHistoryGraph
, RGB(152, 205, 152)) ;
335 GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph
, 0, RGB(255, 0, 0)) ;
336 GraphCtrl_SetPlotColor(&PerformancePageCpuUsageHistoryGraph
, 1, RGB(0, 255, 0)) ;
338 GetClientRect(hPerformancePageMemUsageHistoryGraph
, &rc
);
339 GraphCtrl_Create(&PerformancePageMemUsageHistoryGraph
, hPerformancePageMemUsageHistoryGraph
, hDlg
, IDC_MEM_USAGE_HISTORY_GRAPH
);
340 GraphCtrl_SetRange(&PerformancePageMemUsageHistoryGraph
, 0.0, 100.0, 10) ;
341 GraphCtrl_SetBackgroundColor(&PerformancePageMemUsageHistoryGraph
, RGB(0, 0, 0)) ;
342 GraphCtrl_SetGridColor(&PerformancePageMemUsageHistoryGraph
, RGB(152, 215, 152)) ;
343 GraphCtrl_SetPlotColor(&PerformancePageMemUsageHistoryGraph
, 0, RGB(255, 255, 0)) ;
344 /* Start our refresh thread */
346 CloseHandle( CreateThread(NULL
, 0, PerformancePageRefreshThread
, NULL
, 0, NULL
));
350 * Subclass graph buttons
352 OldGraphWndProc
= (WNDPROC
)SetWindowLongPtrW(hPerformancePageCpuUsageGraph
, GWLP_WNDPROC
, (LONG_PTR
)Graph_WndProc
);
353 SetWindowLongPtrW(hPerformancePageMemUsageGraph
, GWLP_WNDPROC
, (LONG_PTR
)Graph_WndProc
);
354 OldGraphCtrlWndProc
= (WNDPROC
)SetWindowLongPtrW(hPerformancePageMemUsageHistoryGraph
, GWLP_WNDPROC
, (LONG_PTR
)GraphCtrl_WndProc
);
355 SetWindowLongPtrW(hPerformancePageCpuUsageHistoryGraph
, GWLP_WNDPROC
, (LONG_PTR
)GraphCtrl_WndProc
);
363 GetClientRect(hDlg
, &rc
);
364 Draw3dRect(hdc
, rc
.left
, rc
.top
, rc
.right
, rc
.top
+ 2, GetSysColor(COLOR_3DSHADOW
), GetSysColor(COLOR_3DHILIGHT
));
365 ReleaseDC(hDlg
, hdc
);
369 hdc
= BeginPaint(hDlg
, &ps
);
370 GetClientRect(hDlg
, &rc
);
371 Draw3dRect(hdc
, rc
.left
, rc
.top
, rc
.right
, rc
.top
+ 2, GetSysColor(COLOR_3DSHADOW
), GetSysColor(COLOR_3DHILIGHT
));
379 if (wParam
== SIZE_MINIMIZED
)
384 nXDifference
= cx
- nPerformancePageWidth
;
385 nYDifference
= cy
- nPerformancePageHeight
;
386 nPerformancePageWidth
= cx
;
387 nPerformancePageHeight
= cy
;
390 /* Reposition the performance page's controls */
391 AdjustFrameSize(hPerformancePageTotalsFrame
, hDlg
, 0, nYDifference
, 0);
392 AdjustFrameSize(hPerformancePageCommitChargeFrame
, hDlg
, 0, nYDifference
, 0);
393 AdjustFrameSize(hPerformancePageKernelMemoryFrame
, hDlg
, 0, nYDifference
, 0);
394 AdjustFrameSize(hPerformancePagePhysicalMemoryFrame
, hDlg
, 0, nYDifference
, 0);
395 AdjustCntrlPos(IDS_COMMIT_CHARGE_TOTAL
, hDlg
, 0, nYDifference
);
396 AdjustCntrlPos(IDS_COMMIT_CHARGE_LIMIT
, hDlg
, 0, nYDifference
);
397 AdjustCntrlPos(IDS_COMMIT_CHARGE_PEAK
, hDlg
, 0, nYDifference
);
398 AdjustCntrlPos(IDS_KERNEL_MEMORY_TOTAL
, hDlg
, 0, nYDifference
);
399 AdjustCntrlPos(IDS_KERNEL_MEMORY_PAGED
, hDlg
, 0, nYDifference
);
400 AdjustCntrlPos(IDS_KERNEL_MEMORY_NONPAGED
, hDlg
, 0, nYDifference
);
401 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_TOTAL
, hDlg
, 0, nYDifference
);
402 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_AVAILABLE
, hDlg
, 0, nYDifference
);
403 AdjustCntrlPos(IDS_PHYSICAL_MEMORY_SYSTEM_CACHE
, hDlg
, 0, nYDifference
);
404 AdjustCntrlPos(IDS_TOTALS_HANDLE_COUNT
, hDlg
, 0, nYDifference
);
405 AdjustCntrlPos(IDS_TOTALS_PROCESS_COUNT
, hDlg
, 0, nYDifference
);
406 AdjustCntrlPos(IDS_TOTALS_THREAD_COUNT
, hDlg
, 0, nYDifference
);
408 AdjustControlPostion(hPerformancePageCommitChargeTotalEdit
, hDlg
, 0, nYDifference
);
409 AdjustControlPostion(hPerformancePageCommitChargeLimitEdit
, hDlg
, 0, nYDifference
);
410 AdjustControlPostion(hPerformancePageCommitChargePeakEdit
, hDlg
, 0, nYDifference
);
411 AdjustControlPostion(hPerformancePageKernelMemoryTotalEdit
, hDlg
, 0, nYDifference
);
412 AdjustControlPostion(hPerformancePageKernelMemoryPagedEdit
, hDlg
, 0, nYDifference
);
413 AdjustControlPostion(hPerformancePageKernelMemoryNonPagedEdit
, hDlg
, 0, nYDifference
);
414 AdjustControlPostion(hPerformancePagePhysicalMemoryTotalEdit
, hDlg
, 0, nYDifference
);
415 AdjustControlPostion(hPerformancePagePhysicalMemoryAvailableEdit
, hDlg
, 0, nYDifference
);
416 AdjustControlPostion(hPerformancePagePhysicalMemorySystemCacheEdit
, hDlg
, 0, nYDifference
);
417 AdjustControlPostion(hPerformancePageTotalsHandleCountEdit
, hDlg
, 0, nYDifference
);
418 AdjustControlPostion(hPerformancePageTotalsProcessCountEdit
, hDlg
, 0, nYDifference
);
419 AdjustControlPostion(hPerformancePageTotalsThreadCountEdit
, hDlg
, 0, nYDifference
);
422 static int lastX
, lastY
;
424 nXDifference
+= lastX
;
425 nYDifference
+= lastY
;
427 if (nXDifference
% 2) {
428 if (nXDifference
> 0) {
436 if (nYDifference
% 2) {
437 if (nYDifference
> 0) {
447 AdjustFrameSize(hPerformancePageCpuUsageFrame
, hDlg
, nXDifference
, nYDifference
, 1);
448 AdjustFrameSize(hPerformancePageMemUsageFrame
, hDlg
, nXDifference
, nYDifference
, 2);
449 AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame
, hDlg
, nXDifference
, nYDifference
, 3);
450 AdjustFrameSize(hPerformancePageMemUsageHistoryFrame
, hDlg
, nXDifference
, nYDifference
, 4);
451 AdjustFrameSize(hPerformancePageCpuUsageGraph
, hDlg
, nXDifference
, nYDifference
, 1);
452 AdjustFrameSize(hPerformancePageMemUsageGraph
, hDlg
, nXDifference
, nYDifference
, 2);
453 AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph
, hDlg
, nXDifference
, nYDifference
, 3);
454 AdjustFrameSize(hPerformancePageMemUsageHistoryGraph
, hDlg
, nXDifference
, nYDifference
, 4);
460 void PerformancePage_OnViewShowKernelTimes(void)
465 hMenu
= GetMenu(hMainWnd
);
466 hViewMenu
= GetSubMenu(hMenu
, 2);
468 /* Check or uncheck the show 16-bit tasks menu item */
469 if (GetMenuState(hViewMenu
, ID_VIEW_SHOWKERNELTIMES
, MF_BYCOMMAND
) & MF_CHECKED
)
471 CheckMenuItem(hViewMenu
, ID_VIEW_SHOWKERNELTIMES
, MF_BYCOMMAND
|MF_UNCHECKED
);
472 TaskManagerSettings
.ShowKernelTimes
= FALSE
;
476 CheckMenuItem(hViewMenu
, ID_VIEW_SHOWKERNELTIMES
, MF_BYCOMMAND
|MF_CHECKED
);
477 TaskManagerSettings
.ShowKernelTimes
= TRUE
;
480 RefreshPerformancePage();
483 void PerformancePage_OnViewCPUHistoryOneGraphAll(void)
487 HMENU hCPUHistoryMenu
;
489 hMenu
= GetMenu(hMainWnd
);
490 hViewMenu
= GetSubMenu(hMenu
, 2);
491 hCPUHistoryMenu
= GetSubMenu(hViewMenu
, 3);
493 TaskManagerSettings
.CPUHistory_OneGraphPerCPU
= FALSE
;
494 CheckMenuRadioItem(hCPUHistoryMenu
, ID_VIEW_CPUHISTORY_ONEGRAPHALL
, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
, ID_VIEW_CPUHISTORY_ONEGRAPHALL
, MF_BYCOMMAND
);
497 void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void)
501 HMENU hCPUHistoryMenu
;
503 hMenu
= GetMenu(hMainWnd
);
504 hViewMenu
= GetSubMenu(hMenu
, 2);
505 hCPUHistoryMenu
= GetSubMenu(hViewMenu
, 3);
507 TaskManagerSettings
.CPUHistory_OneGraphPerCPU
= TRUE
;
508 CheckMenuRadioItem(hCPUHistoryMenu
, ID_VIEW_CPUHISTORY_ONEGRAPHALL
, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
, MF_BYCOMMAND
);