LV_COLUMN column;
TCHAR szTemp[256];
int cx, cy;
+ HANDLE hRefreshThread = NULL;
switch (message) {
case WM_INITDIALOG:
UpdateApplicationListControlViewSetting();
/* Start our refresh thread */
- CreateThread(NULL, 0, ApplicationPageRefreshThread, NULL, 0, NULL);
+ hRefreshThread = CreateThread(NULL, 0, ApplicationPageRefreshThread, NULL, 0, NULL);
return TRUE;
/* Close the event handle, this will make the */
/* refresh thread exit when the wait fails */
CloseHandle(hApplicationPageEvent);
+ CloseHandle(hRefreshThread);
break;
case WM_COMMAND:
if (!hIcon)
{
- hIcon = (HICON)GetClassLong(hWnd, bLargeIcon ? GCL_HICON : GCL_HICONSM);
- if (!hIcon) hIcon = (HICON)GetClassLong(hWnd, bLargeIcon ? GCL_HICONSM : GCL_HICON);
+ hIcon = (HICON)(LONG_PTR)GetClassLongPtr(hWnd, bLargeIcon ? GCL_HICON : GCL_HICONSM);
+ if (!hIcon) hIcon = (HICON)(LONG_PTR)GetClassLongPtr(hWnd, bLargeIcon ? GCL_HICONSM : GCL_HICON);
if (!hIcon) SendMessageTimeout(hWnd, WM_QUERYDRAGICON, 0, 0, 0, 1000, (PDWORD_PTR)xhIcon);
if (!hIcon) SendMessageTimeout(hWnd, WM_GETICON, bLargeIcon ? ICON_SMALL /*0*/ : ICON_BIG /*1*/, 0, 0, 1000, (PDWORD_PTR)xhIcon);
}
void AddColumns(void)
{
- int size;
+ LRESULT size;
if (TaskManagerSettings.Column_ImageName) {
LoadString(hInst, IDS_TAB_IMAGENAME, szTemp, 256);
HDITEM hditem;
int i;
TCHAR text[260];
- int size;
+ LRESULT size;
/* Reset column data */
for (i=0; i<25; i++)
if (LOWORD(wParam) == IDOK)
{
- TaskManagerSettings.Column_ImageName = SendMessage(GetDlgItem(hDlg, IDC_IMAGENAME), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PID = SendMessage(GetDlgItem(hDlg, IDC_PID), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_UserName = SendMessage(GetDlgItem(hDlg, IDC_USERNAME), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_SessionID = SendMessage(GetDlgItem(hDlg, IDC_SESSIONID), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_CPUUsage = SendMessage(GetDlgItem(hDlg, IDC_CPUUSAGE), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_CPUTime = SendMessage(GetDlgItem(hDlg, IDC_CPUTIME), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_MemoryUsage = SendMessage(GetDlgItem(hDlg, IDC_MEMORYUSAGE), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PeakMemoryUsage = SendMessage(GetDlgItem(hDlg, IDC_PEAKMEMORYUSAGE), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_MemoryUsageDelta = SendMessage(GetDlgItem(hDlg, IDC_MEMORYUSAGEDELTA), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PageFaults = SendMessage(GetDlgItem(hDlg, IDC_PAGEFAULTS), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PageFaultsDelta = SendMessage(GetDlgItem(hDlg, IDC_PAGEFAULTSDELTA), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_VirtualMemorySize = SendMessage(GetDlgItem(hDlg, IDC_VIRTUALMEMORYSIZE), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PagedPool = SendMessage(GetDlgItem(hDlg, IDC_PAGEDPOOL), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_NonPagedPool = SendMessage(GetDlgItem(hDlg, IDC_NONPAGEDPOOL), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_BasePriority = SendMessage(GetDlgItem(hDlg, IDC_BASEPRIORITY), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_HandleCount = SendMessage(GetDlgItem(hDlg, IDC_HANDLECOUNT), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_ThreadCount = SendMessage(GetDlgItem(hDlg, IDC_THREADCOUNT), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_USERObjects = SendMessage(GetDlgItem(hDlg, IDC_USEROBJECTS), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_GDIObjects = SendMessage(GetDlgItem(hDlg, IDC_GDIOBJECTS), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOReads = SendMessage(GetDlgItem(hDlg, IDC_IOREADS), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOWrites = SendMessage(GetDlgItem(hDlg, IDC_IOWRITES), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOOther = SendMessage(GetDlgItem(hDlg, IDC_IOOTHER), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOReadBytes = SendMessage(GetDlgItem(hDlg, IDC_IOREADBYTES), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOWriteBytes = SendMessage(GetDlgItem(hDlg, IDC_IOWRITEBYTES), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOOtherBytes = SendMessage(GetDlgItem(hDlg, IDC_IOOTHERBYTES), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_ImageName = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_IMAGENAME), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_PID = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_PID), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_UserName = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_USERNAME), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_SessionID = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_SESSIONID), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_CPUUsage = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_CPUUSAGE), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_CPUTime = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_CPUTIME), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_MemoryUsage = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_MEMORYUSAGE), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_PeakMemoryUsage = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_PEAKMEMORYUSAGE), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_MemoryUsageDelta = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_MEMORYUSAGEDELTA), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_PageFaults = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_PAGEFAULTS), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_PageFaultsDelta = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_PAGEFAULTSDELTA), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_VirtualMemorySize = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_VIRTUALMEMORYSIZE), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_PagedPool = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_PAGEDPOOL), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_NonPagedPool = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_NONPAGEDPOOL), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_BasePriority = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_BASEPRIORITY), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_HandleCount = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_HANDLECOUNT), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_ThreadCount = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_THREADCOUNT), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_USERObjects = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_USEROBJECTS), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_GDIObjects = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_GDIOBJECTS), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_IOReads = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_IOREADS), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_IOWrites = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_IOWRITES), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_IOOther = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_IOOTHER), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_IOReadBytes = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_IOREADBYTES), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_IOWriteBytes = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_IOWRITEBYTES), BM_GETCHECK, 0, 0);
+ TaskManagerSettings.Column_IOOtherBytes = (BOOL) SendMessage(GetDlgItem(hDlg, IDC_IOOTHERBYTES), BM_GETCHECK, 0, 0);
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
int nlastBarsUsed = 0;
-LONG OldGraphWndProc;
+WNDPROC OldGraphWndProc;
void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd);
void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd);
* Get the CPU usage
*/
CpuUsage = PerfDataGetProcessorUsage();
- if (CpuUsage < 0) CpuUsage = 0;
+ if (CpuUsage <= 0) CpuUsage = 0;
if (CpuUsage > 100) CpuUsage = 100;
_stprintf(Text, _T("%d%%"), (int)CpuUsage);
if (TaskManagerSettings.ShowKernelTimes)
{
- CpuKernelUsage = PerfDataGetProcessorSystemUsage();
- if (CpuKernelUsage < 0) CpuKernelUsage = 0;
- if (CpuKernelUsage > 100) CpuKernelUsage = 100;
+ CpuKernelUsage = PerfDataGetProcessorSystemUsage();
+ if (CpuKernelUsage <= 0) CpuKernelUsage = 0;
+ if (CpuKernelUsage >= 100) CpuKernelUsage = 100;
nBarsUsedKernel = (nBars * CpuKernelUsage) / 100;
}
else
#define BRIGHT_GREEN RGB(0, 255, 0)
#define MEDIUM_GREEN RGB(0, 190, 0)
-#define DARK_GREEN RGB(0, 130, 0)
-#define RED RGB(255, 0, 0)
+#define DARK_GREEN RGB(0, 130, 0)
+#define RED RGB(255, 0, 0)
-extern LONG OldGraphWndProc;
+extern WNDPROC OldGraphWndProc;
INT_PTR CALLBACK Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
#include <precomp.h>
-LONG OldGraphCtrlWndProc;
+WNDPROC OldGraphCtrlWndProc;
static void GraphCtrl_Init(TGraphCtrl* this)
{
void GraphCtrl_Dispose(TGraphCtrl* this)
{
+ int plot;
+
+ for (plot = 0; plot < MAX_PLOTS; plot++)
+ DeleteObject(this->m_penPlot[plot]);
+
/* just to be picky restore the bitmaps for the two memory dc's */
/* (these dc's are being destroyed so there shouldn't be any leaks) */
+
if (this->m_bitmapOldGrid != NULL) SelectObject(this->m_dcGrid, this->m_bitmapOldGrid);
if (this->m_bitmapOldPlot != NULL) SelectObject(this->m_dcPlot, this->m_bitmapOldPlot);
if (this->m_bitmapGrid != NULL) DeleteObject(this->m_bitmapGrid);
// so create a new bitmap of the appropriate size
if(this->m_bitmapGrid != NULL)
{
+ this->m_bitmapGrid = (HBITMAP)SelectObject(this->m_dcGrid, this->m_bitmapOldGrid);
DeleteObject(this->m_bitmapGrid);
this->m_bitmapGrid = CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight);
SelectObject(this->m_dcGrid, this->m_bitmapGrid);
// so create a new bitmap of the appropriate size
if(this->m_bitmapPlot != NULL)
{
+ this->m_bitmapPlot = (HBITMAP)SelectObject(this->m_dcPlot, this->m_bitmapOldPlot);
DeleteObject(this->m_bitmapPlot);
this->m_bitmapPlot = CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight);
SelectObject(this->m_dcPlot, this->m_bitmapPlot);
RECT m_rectPlot;
} TGraphCtrl;
-extern LONG OldGraphCtrlWndProc;
+extern WNDPROC OldGraphCtrlWndProc;
double GraphCtrl_AppendPoint(TGraphCtrl* this,
double dNewPoint0, double dNewPoint1,
double dNewPoint2, double dNewPoint3);
void PerfDataUninitialize(void)
{
+
+ if (pPerfData != NULL)
+ HeapFree(GetProcessHeap(), 0, pPerfData);
+
DeleteCriticalSection(&PerfDataCriticalSection);
if (SystemUserSid != NULL)
/* Get processor time information */
SysProcessorTimeInfo = (PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)HeapAlloc(GetProcessHeap(), 0, sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * SystemBasicInfo.NumberOfProcessors);
status = NtQuerySystemInformation(SystemProcessorPerformanceInformation, SysProcessorTimeInfo, sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * SystemBasicInfo.NumberOfProcessors, &ulSize);
+
if (status != NO_ERROR)
+ {
+ if (SysProcessorTimeInfo != NULL)
+ HeapFree(GetProcessHeap(), 0, SysProcessorTimeInfo);
return;
+ }
/* Get handle information
* We don't know how much data there is so just keep
RECT rc;
int nXDifference;
int nYDifference;
-
+#ifdef RUN_PERF_PAGE
+ HANDLE hRefreshThread = NULL;
+#endif
/* HDC hdc; */
/* PAINTSTRUCT ps; */
switch (message) {
- case WM_DESTROY:
- GraphCtrl_Dispose(&PerformancePageCpuUsageHistoryGraph);
- GraphCtrl_Dispose(&PerformancePageMemUsageHistoryGraph);
- break;
+ case WM_DESTROY:
+ GraphCtrl_Dispose(&PerformancePageCpuUsageHistoryGraph);
+ GraphCtrl_Dispose(&PerformancePageMemUsageHistoryGraph);
+#ifdef RUN_PERF_PAGE
+ CloseHandle(hRefreshThread);
+#endif
+ break;
+
+ case WM_INITDIALOG:
- case WM_INITDIALOG:
-
- /* Save the width and height */
- GetClientRect(hDlg, &rc);
- nPerformancePageWidth = rc.right;
- nPerformancePageHeight = rc.bottom;
-
- /* Update window position */
- SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
-
- /*
- * Get handles to all the controls
- */
- hPerformancePageTotalsFrame = GetDlgItem(hDlg, IDC_TOTALS_FRAME);
- hPerformancePageCommitChargeFrame = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_FRAME);
- hPerformancePageKernelMemoryFrame = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_FRAME);
- hPerformancePagePhysicalMemoryFrame = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_FRAME);
-
- hPerformancePageCpuUsageFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_FRAME);
- hPerformancePageMemUsageFrame = GetDlgItem(hDlg, IDC_MEM_USAGE_FRAME);
- hPerformancePageCpuUsageHistoryFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_FRAME);
- hPerformancePageMemUsageHistoryFrame = GetDlgItem(hDlg, IDC_MEMORY_USAGE_HISTORY_FRAME);
-
- hPerformancePageCommitChargeTotalEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_TOTAL);
- hPerformancePageCommitChargeLimitEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_LIMIT);
- hPerformancePageCommitChargePeakEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_PEAK);
- hPerformancePageKernelMemoryTotalEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_TOTAL);
- hPerformancePageKernelMemoryPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_PAGED);
- hPerformancePageKernelMemoryNonPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_NONPAGED);
- hPerformancePagePhysicalMemoryTotalEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_TOTAL);
- hPerformancePagePhysicalMemoryAvailableEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_AVAILABLE);
- hPerformancePagePhysicalMemorySystemCacheEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE);
- hPerformancePageTotalsHandleCountEdit = GetDlgItem(hDlg, IDC_TOTALS_HANDLE_COUNT);
- hPerformancePageTotalsProcessCountEdit = GetDlgItem(hDlg, IDC_TOTALS_PROCESS_COUNT);
- hPerformancePageTotalsThreadCountEdit = GetDlgItem(hDlg, IDC_TOTALS_THREAD_COUNT);
+ /* Save the width and height */
+ GetClientRect(hDlg, &rc);
+ nPerformancePageWidth = rc.right;
+ nPerformancePageHeight = rc.bottom;
+
+ /* Update window position */
+ SetWindowPos(hDlg, NULL, 15, 30, 0, 0, SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
+
+ /*
+ * Get handles to all the controls
+ */
+ hPerformancePageTotalsFrame = GetDlgItem(hDlg, IDC_TOTALS_FRAME);
+ hPerformancePageCommitChargeFrame = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_FRAME);
+ hPerformancePageKernelMemoryFrame = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_FRAME);
+ hPerformancePagePhysicalMemoryFrame = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_FRAME);
+
+ hPerformancePageCpuUsageFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_FRAME);
+ hPerformancePageMemUsageFrame = GetDlgItem(hDlg, IDC_MEM_USAGE_FRAME);
+ hPerformancePageCpuUsageHistoryFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_FRAME);
+ hPerformancePageMemUsageHistoryFrame = GetDlgItem(hDlg, IDC_MEMORY_USAGE_HISTORY_FRAME);
+
+ hPerformancePageCommitChargeTotalEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_TOTAL);
+ hPerformancePageCommitChargeLimitEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_LIMIT);
+ hPerformancePageCommitChargePeakEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_PEAK);
+ hPerformancePageKernelMemoryTotalEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_TOTAL);
+ hPerformancePageKernelMemoryPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_PAGED);
+ hPerformancePageKernelMemoryNonPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_NONPAGED);
+ hPerformancePagePhysicalMemoryTotalEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_TOTAL);
+ hPerformancePagePhysicalMemoryAvailableEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_AVAILABLE);
+ hPerformancePagePhysicalMemorySystemCacheEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE);
+ hPerformancePageTotalsHandleCountEdit = GetDlgItem(hDlg, IDC_TOTALS_HANDLE_COUNT);
+ hPerformancePageTotalsProcessCountEdit = GetDlgItem(hDlg, IDC_TOTALS_PROCESS_COUNT);
+ hPerformancePageTotalsThreadCountEdit = GetDlgItem(hDlg, IDC_TOTALS_THREAD_COUNT);
hPerformancePageCpuUsageGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_GRAPH);
- hPerformancePageMemUsageGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_GRAPH);
- hPerformancePageMemUsageHistoryGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_HISTORY_GRAPH);
+ hPerformancePageMemUsageGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_GRAPH);
+ hPerformancePageMemUsageHistoryGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_HISTORY_GRAPH);
hPerformancePageCpuUsageHistoryGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
-
- GetClientRect(hPerformancePageCpuUsageHistoryGraph, &rc);
+
+ GetClientRect(hPerformancePageCpuUsageHistoryGraph, &rc);
/* create the control */
/* PerformancePageCpuUsageHistoryGraph.Create(0, rc, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH); */
GraphCtrl_Create(&PerformancePageCpuUsageHistoryGraph, hPerformancePageCpuUsageHistoryGraph, hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
GraphCtrl_SetBackgroundColor(&PerformancePageMemUsageHistoryGraph, RGB(0, 0, 0)) ;
GraphCtrl_SetGridColor(&PerformancePageMemUsageHistoryGraph, RGB(152, 215, 152)) ;
GraphCtrl_SetPlotColor(&PerformancePageMemUsageHistoryGraph, 0, RGB(255, 255, 0)) ;
- /* Start our refresh thread */
+ /* Start our refresh thread */
#ifdef RUN_PERF_PAGE
- CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, NULL);
+ hRefreshThread = CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, NULL);
#endif
- /*
- * Subclass graph buttons
- */
- OldGraphWndProc = SetWindowLongPtr(hPerformancePageCpuUsageGraph, GWL_WNDPROC, (DWORD_PTR)Graph_WndProc);
- SetWindowLongPtr(hPerformancePageMemUsageGraph, GWL_WNDPROC, (DWORD_PTR)Graph_WndProc);
- OldGraphCtrlWndProc = SetWindowLongPtr(hPerformancePageMemUsageHistoryGraph, GWL_WNDPROC, (DWORD_PTR)GraphCtrl_WndProc);
- SetWindowLongPtr(hPerformancePageCpuUsageHistoryGraph, GWL_WNDPROC, (DWORD_PTR)GraphCtrl_WndProc);
- return TRUE;
+ /*
+ * Subclass graph buttons
+ */
+ OldGraphWndProc = (WNDPROC)(LONG_PTR) SetWindowLongPtr(hPerformancePageCpuUsageGraph, GWL_WNDPROC, (LONG_PTR)Graph_WndProc);
+ SetWindowLongPtr(hPerformancePageMemUsageGraph, GWL_WNDPROC, (LONG_PTR)Graph_WndProc);
+ OldGraphCtrlWndProc = (WNDPROC)(LONG_PTR) SetWindowLongPtr(hPerformancePageMemUsageHistoryGraph, GWL_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
+ SetWindowLongPtr(hPerformancePageCpuUsageHistoryGraph, GWL_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
+ return TRUE;
case WM_COMMAND:
break;
* Get the CPU usage
*/
CpuUsage = PerfDataGetProcessorUsage();
- if (CpuUsage < 0 ) CpuUsage = 0;
+ if (CpuUsage <= 0 ) CpuUsage = 0;
if (CpuUsage > 100) CpuUsage = 100;
if (TaskManagerSettings.ShowKernelTimes)
{
CpuKernelUsage = PerfDataGetProcessorSystemUsage();
- if (CpuKernelUsage < 0) CpuKernelUsage = 0;
+ if (CpuKernelUsage <= 0) CpuKernelUsage = 0;
if (CpuKernelUsage > 100) CpuKernelUsage = 100;
}
else
/*
* Get the background brush
*/
- hbrBackground = (HBRUSH) GetClassLong(hWnd, GCL_HBRBACKGROUND);
+ hbrBackground = (HBRUSH)(LONG_PTR) GetClassLongPtr(hWnd, GCL_HBRBACKGROUND);
/*
* Calculate the clip rect by getting the RECT
INT_PTR CALLBACK
ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- RECT rc;
+ RECT rc;
int nXDifference;
int nYDifference;
int cx, cy;
+ HANDLE hRefreshThread = NULL;
switch (message) {
case WM_INITDIALOG:
/*
* Subclass the process list control so we can intercept WM_ERASEBKGND
*/
- OldProcessListWndProc = (WNDPROC)SetWindowLongPtr(hProcessPageListCtrl, GWL_WNDPROC, (DWORD_PTR)ProcessListWndProc);
+ OldProcessListWndProc = (WNDPROC)(LONG_PTR) SetWindowLongPtr(hProcessPageListCtrl, GWL_WNDPROC, (LONG_PTR)ProcessListWndProc);
/* Start our refresh thread */
- CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL);
+ hRefreshThread = CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL);
return TRUE;
/* Close the event handle, this will make the */
/* refresh thread exit when the wait fails */
CloseHandle(hProcessPageEvent);
+ CloseHandle(hRefreshThread);
SaveColumnSettings();
nParts[0] = 100;
nParts[1] = 210;
nParts[2] = 400;
- SendMessage(hStatusWnd, SB_SETPARTS, 3, (long)nParts);
+ SendMessage(hStatusWnd, SB_SETPARTS, 3, (LPARAM) (LPINT) nParts);
/* Create tab pages */
hTabWnd = GetDlgItem(hWnd, IDC_TAB);
* This function handles all the moving events for the application
* It moves every child window that needs moving
*/
-void OnMove( UINT nType, int cx, int cy )
+void OnMove( WPARAM nType, int cx, int cy )
{
#ifdef __GNUC__TEST__
MoveWindow(hApplicationPage, TaskManagerSettings.Left + PAGE_OFFSET_LEFT, TaskManagerSettings.Top + PAGE_OFFSET_TOP, TaskManagerSettings.Right - TaskManagerSettings.Left - PAGE_OFFSET_WIDTH, TaskManagerSettings.Bottom - TaskManagerSettings.Top - PAGE_OFFSET_HEIGHT, FALSE);
* This function handles all the sizing events for the application
* It re-sizes every window, and child window that needs re-sizing
*/
-void OnSize( UINT nType, int cx, int cy )
+void OnSize( WPARAM nType, int cx, int cy )
{
int nParts[3];
int nXDifference;
nParts[0] = bInMenuLoop ? -1 : 100;
nParts[1] = 210;
nParts[2] = cx;
- SendMessage(hStatusWnd, SB_SETPARTS, bInMenuLoop ? 1 : 3, (long)nParts);
+ SendMessage(hStatusWnd, SB_SETPARTS, bInMenuLoop ? 1 : 3, (LPARAM) (LPINT) nParts);
/* Resize the tab control */
GetWindowRect(hTabWnd, &rc);
/* Update the status bar pane sizes */
nParts = -1;
- SendMessage(hStatusWnd, SB_SETPARTS, 1, (long)&nParts);
+ SendMessage(hStatusWnd, SB_SETPARTS, 1, (LPARAM) (LPINT)&nParts);
bInMenuLoop = TRUE;
SendMessage(hStatusWnd, SB_SETTEXT, (WPARAM)0, (LPARAM)_T(""));
}
nParts[0] = 100;
nParts[1] = 210;
nParts[2] = rc.right;
- SendMessage(hStatusWnd, SB_SETPARTS, 3, (long)nParts);
+ SendMessage(hStatusWnd, SB_SETPARTS, 3, (LPARAM) (LPINT) nParts);
SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)_T(""));
wsprintf(text, szCpuUsage, PerfDataGetProcessorUsage());
SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text);
hSubMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_WINDOWSMENU));
LoadString(hInst, IDS_MENU_WINDOWS, szTemp, 256);
- InsertMenu(hMenu, 3, MF_BYPOSITION|MF_POPUP, (UINT)hSubMenu, szTemp);
+ InsertMenu(hMenu, 3, MF_BYPOSITION|MF_POPUP, (UINT_PTR) hSubMenu, szTemp);
DrawMenuBar(hMainWnd);
}
AppendMenu(hSubMenu, MF_STRING, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, szTemp);
LoadString(hInst, IDS_MENU_CPUHISTORY, szTemp, 256);
- AppendMenu(hViewMenu, MF_STRING|MF_POPUP, (UINT)hSubMenu, szTemp);
+ AppendMenu(hViewMenu, MF_STRING|MF_POPUP, (UINT_PTR) hSubMenu, szTemp);
LoadString(hInst, IDS_MENU_SHOWKERNELTIMES, szTemp, 256);
AppendMenu(hViewMenu, MF_STRING, ID_VIEW_SHOWKERNELTIMES, szTemp);
/* Foward declarations of functions included in this code module: */
INT_PTR CALLBACK TaskManagerWndProc(HWND, UINT, WPARAM, LPARAM);
BOOL OnCreate(HWND hWnd);
-void OnSize(UINT nType, int cx, int cy);
-void OnMove(UINT nType, int cx, int cy);
+void OnSize(WPARAM nType, int cx, int cy);
+void OnMove(WPARAM nType, int cx, int cy);
void FillSolidRect(HDC hDC, LPCRECT lpRect, COLORREF clr);
void FillSolidRect2(HDC hDC, int x, int y, int cx, int cy, COLORREF clr);
void Draw3dRect(HDC hDC, int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight);
* Now that we are done drawing put the
* old bitmap back.
*/
- SelectObject(hDC, hOldBitmap);
+ hBitmap = SelectObject(hDC, hOldBitmap);
hOldBitmap = NULL;
iconInfo.fIcon = TRUE;
if (hScreenDC)
ReleaseDC(NULL, hScreenDC);
if (hOldBitmap)
- SelectObject(hDC, hOldBitmap);
+ hBitmap = SelectObject(hDC, hOldBitmap);
if (hDC)
DeleteDC(hDC);
if (hBitmapBrush)