[TASKMGR] Completely reformat perfpage.c, perfpage.h, procpage.h and trayicon.c

- Rename also these stupidly long "hPerformancePageBlablabla" variables.
- Remove unnecessary global variables in procpage.c/h.
This commit is contained in:
Hermès Bélusca-Maïto 2022-05-15 21:51:29 +02:00
parent da7dcec6a0
commit 7b53126375
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
5 changed files with 300 additions and 315 deletions

View file

@ -14,30 +14,30 @@ TM_GRAPH_CONTROL PerformancePageCpuUsageHistoryGraph;
TM_GRAPH_CONTROL PerformancePageMemUsageHistoryGraph;
HWND hPerformancePage; /* Performance Property Page */
HWND hPerformancePageCpuUsageGraph; /* CPU Usage Graph */
HWND hPerformancePageMemUsageGraph; /* MEM Usage Graph */
static HWND hCpuUsageGraph; /* CPU Usage Graph */
static HWND hMemUsageGraph; /* MEM Usage Graph */
HWND hPerformancePageCpuUsageHistoryGraph; /* CPU Usage History Graph */
HWND hPerformancePageMemUsageHistoryGraph; /* Memory Usage History Graph */
HWND hPerformancePageTotalsFrame; /* Totals Frame */
HWND hPerformancePageCommitChargeFrame; /* Commit Charge Frame */
HWND hPerformancePageKernelMemoryFrame; /* Kernel Memory Frame */
HWND hPerformancePagePhysicalMemoryFrame; /* Physical Memory Frame */
HWND hPerformancePageCpuUsageFrame;
HWND hPerformancePageMemUsageFrame;
HWND hPerformancePageCpuUsageHistoryFrame;
HWND hPerformancePageMemUsageHistoryFrame;
HWND hPerformancePageCommitChargeTotalEdit; /* Commit Charge Total Edit Control */
HWND hPerformancePageCommitChargeLimitEdit; /* Commit Charge Limit Edit Control */
HWND hPerformancePageCommitChargePeakEdit; /* Commit Charge Peak Edit Control */
HWND hPerformancePageKernelMemoryTotalEdit; /* Kernel Memory Total Edit Control */
HWND hPerformancePageKernelMemoryPagedEdit; /* Kernel Memory Paged Edit Control */
HWND hPerformancePageKernelMemoryNonPagedEdit; /* Kernel Memory NonPaged Edit Control */
HWND hPerformancePagePhysicalMemoryTotalEdit; /* Physical Memory Total Edit Control */
HWND hPerformancePagePhysicalMemoryAvailableEdit; /* Physical Memory Available Edit Control */
HWND hPerformancePagePhysicalMemorySystemCacheEdit; /* Physical Memory System Cache Edit Control */
HWND hPerformancePageTotalsHandleCountEdit; /* Total Handles Edit Control */
HWND hPerformancePageTotalsProcessCountEdit; /* Total Processes Edit Control */
HWND hPerformancePageTotalsThreadCountEdit; /* Total Threads Edit Control */
static HWND hTotalsFrame; /* Totals Frame */
static HWND hCommitChargeFrame; /* Commit Charge Frame */
static HWND hKernelMemoryFrame; /* Kernel Memory Frame */
static HWND hPhysicalMemoryFrame; /* Physical Memory Frame */
static HWND hCpuUsageFrame;
static HWND hMemUsageFrame;
static HWND hCpuUsageHistoryFrame;
static HWND hMemUsageHistoryFrame;
static HWND hCommitChargeTotalEdit; /* Commit Charge Total Edit Control */
static HWND hCommitChargeLimitEdit; /* Commit Charge Limit Edit Control */
static HWND hCommitChargePeakEdit; /* Commit Charge Peak Edit Control */
static HWND hKernelMemoryTotalEdit; /* Kernel Memory Total Edit Control */
static HWND hKernelMemoryPagedEdit; /* Kernel Memory Paged Edit Control */
static HWND hKernelMemoryNonPagedEdit; /* Kernel Memory NonPaged Edit Control */
static HWND hPhysicalMemoryTotalEdit; /* Physical Memory Total Edit Control */
static HWND hPhysicalMemoryAvailableEdit; /* Physical Memory Available Edit Control */
static HWND hPhysicalMemorySystemCacheEdit; /* Physical Memory System Cache Edit Control */
static HWND hTotalsHandleCountEdit; /* Total Handles Edit Control */
static HWND hTotalsProcessCountEdit; /* Total Processes Edit Control */
static HWND hTotalsThreadCountEdit; /* Total Threads Edit Control */
#ifdef RUN_PERF_PAGE
static HANDLE hPerformanceThread = NULL;
@ -47,7 +47,7 @@ static DWORD dwPerformanceThread;
static int nPerformancePageWidth;
static int nPerformancePageHeight;
static int lastX, lastY;
DWORD WINAPI PerformancePageRefreshThread(void *lpParameter);
DWORD WINAPI PerformancePageRefreshThread(PVOID Parameter);
void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference, int pos)
{
@ -84,12 +84,14 @@ void AdjustFrameSize(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference,
InvalidateRect(hCntrl, NULL, TRUE);
}
static void AdjustControlPosition(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference)
static inline
void AdjustControlPosition(HWND hCntrl, HWND hDlg, int nXDifference, int nYDifference)
{
AdjustFrameSize(hCntrl, hDlg, nXDifference, nYDifference, 0);
}
static void AdjustCntrlPos(int ctrl_id, HWND hDlg, int nXDifference, int nYDifference)
static inline
void AdjustCntrlPos(int ctrl_id, HWND hDlg, int nXDifference, int nYDifference)
{
AdjustFrameSize(GetDlgItem(hDlg, ctrl_id), hDlg, nXDifference, nYDifference, 0);
}
@ -98,12 +100,9 @@ INT_PTR CALLBACK
PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
RECT rc;
int nXDifference;
int nYDifference;
/* HDC hdc; */
/* PAINTSTRUCT ps; */
switch (message) {
switch (message)
{
case WM_DESTROY:
GraphCtrl_Dispose(&PerformancePageCpuUsageHistoryGraph);
GraphCtrl_Dispose(&PerformancePageMemUsageHistoryGraph);
@ -128,31 +127,31 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
/*
* 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);
hTotalsFrame = GetDlgItem(hDlg, IDC_TOTALS_FRAME);
hCommitChargeFrame = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_FRAME);
hKernelMemoryFrame = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_FRAME);
hPhysicalMemoryFrame = 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);
hCpuUsageFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_FRAME);
hMemUsageFrame = GetDlgItem(hDlg, IDC_MEM_USAGE_FRAME);
hCpuUsageHistoryFrame = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_FRAME);
hMemUsageHistoryFrame = 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);
hCommitChargeTotalEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_TOTAL);
hCommitChargeLimitEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_LIMIT);
hCommitChargePeakEdit = GetDlgItem(hDlg, IDC_COMMIT_CHARGE_PEAK);
hKernelMemoryTotalEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_TOTAL);
hKernelMemoryPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_PAGED);
hKernelMemoryNonPagedEdit = GetDlgItem(hDlg, IDC_KERNEL_MEMORY_NONPAGED);
hPhysicalMemoryTotalEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_TOTAL);
hPhysicalMemoryAvailableEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_AVAILABLE);
hPhysicalMemorySystemCacheEdit = GetDlgItem(hDlg, IDC_PHYSICAL_MEMORY_SYSTEM_CACHE);
hTotalsHandleCountEdit = GetDlgItem(hDlg, IDC_TOTALS_HANDLE_COUNT);
hTotalsProcessCountEdit = GetDlgItem(hDlg, IDC_TOTALS_PROCESS_COUNT);
hTotalsThreadCountEdit = GetDlgItem(hDlg, IDC_TOTALS_THREAD_COUNT);
hPerformancePageCpuUsageGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_GRAPH);
hPerformancePageMemUsageGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_GRAPH);
hCpuUsageGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_GRAPH);
hMemUsageGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_GRAPH);
hPerformancePageMemUsageHistoryGraph = GetDlgItem(hDlg, IDC_MEM_USAGE_HISTORY_GRAPH);
hPerformancePageCpuUsageHistoryGraph = GetDlgItem(hDlg, IDC_CPU_USAGE_HISTORY_GRAPH);
@ -188,8 +187,8 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
/*
* Subclass graph buttons
*/
OldGraphWndProc = (WNDPROC)SetWindowLongPtrW(hPerformancePageCpuUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
SetWindowLongPtrW(hPerformancePageMemUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
OldGraphWndProc = (WNDPROC)SetWindowLongPtrW(hCpuUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
SetWindowLongPtrW(hMemUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
OldGraphCtrlWndProc = (WNDPROC)SetWindowLongPtrW(hPerformancePageMemUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
SetWindowLongPtrW(hPerformancePageCpuUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
return TRUE;
@ -197,24 +196,12 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
case WM_COMMAND:
break;
#if 0
case WM_NCPAINT:
hdc = GetDC(hDlg);
GetClientRect(hDlg, &rc);
Draw3dRect(hdc, rc.left, rc.top, rc.right, rc.top + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
ReleaseDC(hDlg, hdc);
break;
case WM_PAINT:
hdc = BeginPaint(hDlg, &ps);
GetClientRect(hDlg, &rc);
Draw3dRect(hdc, rc.left, rc.top, rc.right, rc.top + 2, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
EndPaint(hDlg, &ps);
break;
#endif
case WM_SIZE:
do {
{
int cx, cy;
int nXDifference;
int nYDifference;
if (wParam == SIZE_MINIMIZED)
return 0;
@ -225,13 +212,12 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
nYDifference = cy - nPerformancePageHeight;
nPerformancePageWidth = cx;
nPerformancePageHeight = cy;
} while (0);
/* Reposition the performance page's controls */
AdjustFrameSize(hPerformancePageTotalsFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hPerformancePageCommitChargeFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hPerformancePageKernelMemoryFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hPerformancePagePhysicalMemoryFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hTotalsFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hCommitChargeFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hKernelMemoryFrame, hDlg, 0, nYDifference, 0);
AdjustFrameSize(hPhysicalMemoryFrame, hDlg, 0, nYDifference, 0);
AdjustCntrlPos(IDS_COMMIT_CHARGE_TOTAL, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_COMMIT_CHARGE_LIMIT, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_COMMIT_CHARGE_PEAK, hDlg, 0, nYDifference);
@ -245,63 +231,72 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
AdjustCntrlPos(IDS_TOTALS_PROCESS_COUNT, hDlg, 0, nYDifference);
AdjustCntrlPos(IDS_TOTALS_THREAD_COUNT, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageCommitChargeTotalEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageCommitChargeLimitEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageCommitChargePeakEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageKernelMemoryTotalEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageKernelMemoryPagedEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageKernelMemoryNonPagedEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePagePhysicalMemoryTotalEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePagePhysicalMemoryAvailableEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePagePhysicalMemorySystemCacheEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageTotalsHandleCountEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageTotalsProcessCountEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPerformancePageTotalsThreadCountEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hCommitChargeTotalEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hCommitChargeLimitEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hCommitChargePeakEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hKernelMemoryTotalEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hKernelMemoryPagedEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hKernelMemoryNonPagedEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPhysicalMemoryTotalEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPhysicalMemoryAvailableEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hPhysicalMemorySystemCacheEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hTotalsHandleCountEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hTotalsProcessCountEdit, hDlg, 0, nYDifference);
AdjustControlPosition(hTotalsThreadCountEdit, hDlg, 0, nYDifference);
nXDifference += lastX;
nYDifference += lastY;
lastX = lastY = 0;
if (nXDifference % 2) {
if (nXDifference > 0) {
if (nXDifference % 2)
{
if (nXDifference > 0)
{
nXDifference--;
lastX++;
} else {
}
else
{
nXDifference++;
lastX--;
}
}
if (nYDifference % 2) {
if (nYDifference > 0) {
if (nYDifference % 2)
{
if (nYDifference > 0)
{
nYDifference--;
lastY++;
} else {
}
else
{
nYDifference++;
lastY--;
}
}
AdjustFrameSize(hPerformancePageCpuUsageFrame, hDlg, nXDifference, nYDifference, 1);
AdjustFrameSize(hPerformancePageMemUsageFrame, hDlg, nXDifference, nYDifference, 2);
AdjustFrameSize(hPerformancePageCpuUsageHistoryFrame, hDlg, nXDifference, nYDifference, 3);
AdjustFrameSize(hPerformancePageMemUsageHistoryFrame, hDlg, nXDifference, nYDifference, 4);
AdjustFrameSize(hPerformancePageCpuUsageGraph, hDlg, nXDifference, nYDifference, 1);
AdjustFrameSize(hPerformancePageMemUsageGraph, hDlg, nXDifference, nYDifference, 2);
AdjustFrameSize(hCpuUsageFrame, hDlg, nXDifference, nYDifference, 1);
AdjustFrameSize(hMemUsageFrame, hDlg, nXDifference, nYDifference, 2);
AdjustFrameSize(hCpuUsageHistoryFrame, hDlg, nXDifference, nYDifference, 3);
AdjustFrameSize(hMemUsageHistoryFrame, hDlg, nXDifference, nYDifference, 4);
AdjustFrameSize(hCpuUsageGraph, hDlg, nXDifference, nYDifference, 1);
AdjustFrameSize(hMemUsageGraph, hDlg, nXDifference, nYDifference, 2);
AdjustFrameSize(hPerformancePageCpuUsageHistoryGraph, hDlg, nXDifference, nYDifference, 3);
AdjustFrameSize(hPerformancePageMemUsageHistoryGraph, hDlg, nXDifference, nYDifference, 4);
break;
}
}
return 0;
}
void RefreshPerformancePage(void)
{
#ifdef RUN_PERF_PAGE
/* Signal the event so that our refresh thread */
/* will wake up and refresh the performance page */
/* Signal the event so that our refresh thread
* will wake up and refresh the performance page */
PostThreadMessage(dwPerformanceThread, WM_TIMER, 0, 0);
#endif
}
DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
DWORD WINAPI PerformancePageRefreshThread(PVOID Parameter)
{
ULONGLONG CommitChargeTotal;
ULONGLONG CommitChargeLimit;
@ -327,9 +322,9 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
WCHAR Text[260];
WCHAR szMemUsage[256], szCpuUsage[256], szProcesses[256];
LoadStringW(hInst, IDS_STATUS_CPUUSAGE, szCpuUsage, 256);
LoadStringW(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, 256);
LoadStringW(hInst, IDS_STATUS_PROCESSES, szProcesses, 256);
LoadStringW(hInst, IDS_STATUS_CPUUSAGE, szCpuUsage, ARRAYSIZE(szCpuUsage));
LoadStringW(hInst, IDS_STATUS_MEMUSAGE, szMemUsage, ARRAYSIZE(szMemUsage));
LoadStringW(hInst, IDS_STATUS_PROCESSES, szProcesses, ARRAYSIZE(szProcesses));
while (1)
{
@ -352,19 +347,19 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
CommitChargeLimit = PerfDataGetCommitChargeLimitK();
CommitChargePeak = PerfDataGetCommitChargePeakK();
_ultow(CommitChargeTotal, Text, 10);
SetWindowTextW(hPerformancePageCommitChargeTotalEdit, Text);
SetWindowTextW(hCommitChargeTotalEdit, Text);
_ultow(CommitChargeLimit, Text, 10);
SetWindowTextW(hPerformancePageCommitChargeLimitEdit, Text);
SetWindowTextW(hCommitChargeLimitEdit, Text);
_ultow(CommitChargePeak, Text, 10);
SetWindowTextW(hPerformancePageCommitChargePeakEdit, Text);
SetWindowTextW(hCommitChargePeakEdit, Text);
StrFormatByteSizeW(CommitChargeTotal * 1024,
szChargeTotalFormat,
_countof(szChargeTotalFormat));
ARRAYSIZE(szChargeTotalFormat));
StrFormatByteSizeW(CommitChargeLimit * 1024,
szChargeLimitFormat,
_countof(szChargeLimitFormat));
ARRAYSIZE(szChargeLimitFormat));
if (!bInMenuLoop)
{
@ -380,11 +375,11 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
KernelMemoryPaged = PerfDataGetKernelMemoryPagedK();
KernelMemoryNonPaged = PerfDataGetKernelMemoryNonPagedK();
_ultow(KernelMemoryTotal, Text, 10);
SetWindowTextW(hPerformancePageKernelMemoryTotalEdit, Text);
SetWindowTextW(hKernelMemoryTotalEdit, Text);
_ultow(KernelMemoryPaged, Text, 10);
SetWindowTextW(hPerformancePageKernelMemoryPagedEdit, Text);
SetWindowTextW(hKernelMemoryPagedEdit, Text);
_ultow(KernelMemoryNonPaged, Text, 10);
SetWindowTextW(hPerformancePageKernelMemoryNonPagedEdit, Text);
SetWindowTextW(hKernelMemoryNonPagedEdit, Text);
/*
* Update the physical memory info
@ -393,11 +388,11 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
PhysicalMemoryAvailable = PerfDataGetPhysicalMemoryAvailableK();
PhysicalMemorySystemCache = PerfDataGetPhysicalMemorySystemCacheK();
_ultow(PhysicalMemoryTotal, Text, 10);
SetWindowTextW(hPerformancePagePhysicalMemoryTotalEdit, Text);
SetWindowTextW(hPhysicalMemoryTotalEdit, Text);
_ultow(PhysicalMemoryAvailable, Text, 10);
SetWindowTextW(hPerformancePagePhysicalMemoryAvailableEdit, Text);
SetWindowTextW(hPhysicalMemoryAvailableEdit, Text);
_ultow(PhysicalMemorySystemCache, Text, 10);
SetWindowTextW(hPerformancePagePhysicalMemorySystemCacheEdit, Text);
SetWindowTextW(hPhysicalMemorySystemCacheEdit, Text);
/*
* Update the totals info
@ -406,11 +401,11 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
TotalThreads = PerfDataGetTotalThreadCount();
TotalProcesses = PerfDataGetProcessCount();
_ultow(TotalHandles, Text, 10);
SetWindowTextW(hPerformancePageTotalsHandleCountEdit, Text);
SetWindowTextW(hTotalsHandleCountEdit, Text);
_ultow(TotalThreads, Text, 10);
SetWindowTextW(hPerformancePageTotalsThreadCountEdit, Text);
SetWindowTextW(hTotalsThreadCountEdit, Text);
_ultow(TotalProcesses, Text, 10);
SetWindowTextW(hPerformancePageTotalsProcessCountEdit, Text);
SetWindowTextW(hTotalsProcessCountEdit, Text);
if (!bInMenuLoop)
{
wsprintfW(Text, szProcesses, TotalProcesses);
@ -420,8 +415,8 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
/*
* Redraw the graphs
*/
InvalidateRect(hPerformancePageCpuUsageGraph, NULL, FALSE);
InvalidateRect(hPerformancePageMemUsageGraph, NULL, FALSE);
InvalidateRect(hCpuUsageGraph, NULL, FALSE);
InvalidateRect(hMemUsageGraph, NULL, FALSE);
/*
* Get the CPU usage
@ -515,4 +510,3 @@ void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void)
TaskManagerSettings.CPUHistory_OneGraphPerCPU = TRUE;
CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND);
}

View file

@ -13,6 +13,7 @@ extern "C" {
extern HWND hPerformancePage; /* Performance Property Page */
INT_PTR CALLBACK PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
void RefreshPerformancePage(void);
void PerformancePage_OnViewShowKernelTimes(void);
void PerformancePage_OnViewCPUHistoryOneGraphAll(void);

View file

@ -27,8 +27,8 @@ HWND hProcessPage; /* Process List Property Page */
HWND hProcessPageListCtrl; /* Process ListCtrl Window */
HWND hProcessPageHeaderCtrl; /* Process Header Control */
HWND hProcessPageEndProcessButton; /* Process End Process button */
HWND hProcessPageShowAllProcessesButton;/* Process Show All Processes checkbox */
static HWND hProcessPageEndProcessButton; /* Process End Process button */
static HWND hProcessPageShowAllProcessesButton;/* Process Show All Processes checkbox */
BOOL bProcessPageSelectionMade = FALSE; /* Is item in ListCtrl selected */
static int nProcessPageWidth;

View file

@ -12,8 +12,6 @@
extern HWND hProcessPage; /* Process List Property Page */
extern HWND hProcessPageListCtrl; /* Process ListCtrl Window */
extern HWND hProcessPageHeaderCtrl; /* Process Header Control */
extern HWND hProcessPageEndProcessButton; /* Process End Process button */
extern HWND hProcessPageShowAllProcessesButton; /* Process Show All Processes checkbox */
INT_PTR CALLBACK ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
void RefreshProcessPage(void);

View file

@ -22,16 +22,12 @@ HICON TrayIcon_GetProcessorUsageIcon(void)
HBRUSH hBitmapBrush = NULL;
RECT rc;
/*
* Get a handle to the screen DC
*/
/* Get a handle to the screen DC */
hScreenDC = GetDC(NULL);
if (!hScreenDC)
goto done;
/*
* Create our own DC from it
*/
/* Create our own DC from it */
hDC = CreateCompatibleDC(hScreenDC);
if (!hDC)
goto done;
@ -52,7 +48,7 @@ HICON TrayIcon_GetProcessorUsageIcon(void)
* Select the bitmap into our device context
* so we can draw on it.
*/
hOldBitmap = (HBITMAP) SelectObject(hDC, hBitmap);
hOldBitmap = SelectObject(hDC, hBitmap);
/*
* Get the cpu usage
@ -71,9 +67,7 @@ HICON TrayIcon_GetProcessorUsageIcon(void)
rc.right = 13;
rc.bottom = 13;
/*
* Now draw the cpu usage
*/
/* Now draw the cpu usage */
if (nLinesToDraw)
FillRect(hDC, &rc, hBitmapBrush);
@ -105,9 +99,7 @@ done:
if (hBitmapMask)
DeleteObject(hBitmapMask);
/*
* Return the newly created tray icon (if successful)
*/
/* Return the newly created tray icon (if successful) */
return hTrayIcon;
}