https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7b53126375ee8889cf24615fa2ea646feabee0ae

commit 7b53126375ee8889cf24615fa2ea646feabee0ae
Author:     Hermès Bélusca-Maïto <[email protected]>
AuthorDate: Sun May 15 21:51:29 2022 +0200
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Thu Jun 15 12:44:13 2023 +0200

    [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.
---
 base/applications/taskmgr/perfpage.c | 528 +++++++++++++++++------------------
 base/applications/taskmgr/perfpage.h |  13 +-
 base/applications/taskmgr/procpage.c |   4 +-
 base/applications/taskmgr/procpage.h |  18 +-
 base/applications/taskmgr/trayicon.c |  42 ++-
 5 files changed, 295 insertions(+), 310 deletions(-)

diff --git a/base/applications/taskmgr/perfpage.c 
b/base/applications/taskmgr/perfpage.c
index e212581633e..df36c918859 100644
--- a/base/applications/taskmgr/perfpage.c
+++ b/base/applications/taskmgr/perfpage.c
@@ -13,41 +13,41 @@ extern BOOL bInMenuLoop;        /* Tells us if we are in 
the menu loop - from ta
 TM_GRAPH_CONTROL PerformancePageCpuUsageHistoryGraph;
 TM_GRAPH_CONTROL PerformancePageMemUsageHistoryGraph;
 
-HWND  hPerformancePage;                               /*  Performance Property 
Page */
-HWND  hPerformancePageCpuUsageGraph;                  /*  CPU Usage Graph */
-HWND  hPerformancePageMemUsageGraph;                  /*  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 */
+HWND hPerformancePage;                /* Performance Property Page */
+static HWND hCpuUsageGraph;                  /* CPU Usage Graph */
+static HWND hMemUsageGraph;                  /* MEM Usage Graph */
+HWND hPerformancePageCpuUsageHistoryGraph;           /* CPU Usage History 
Graph */
+HWND hPerformancePageMemUsageHistoryGraph;           /* Memory Usage History 
Graph */
+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;
 static DWORD  dwPerformanceThread;
 #endif
 
-static int     nPerformancePageWidth;
-static int     nPerformancePageHeight;
-static int     lastX, lastY;
-DWORD WINAPI   PerformancePageRefreshThread(void *lpParameter);
+static int nPerformancePageWidth;
+static int nPerformancePageHeight;
+static int lastX, lastY;
+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);
 }
@@ -97,197 +99,190 @@ static void AdjustCntrlPos(int ctrl_id, HWND hDlg, int 
nXDifference, int nYDiffe
 INT_PTR CALLBACK
 PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    RECT  rc;
-    int   nXDifference;
-    int   nYDifference;
-/*     HDC hdc; */
-/*     PAINTSTRUCT ps; */
-
-    switch (message) {
-    case WM_DESTROY:
-        GraphCtrl_Dispose(&PerformancePageCpuUsageHistoryGraph);
-        GraphCtrl_Dispose(&PerformancePageMemUsageHistoryGraph);
+    RECT rc;
+
+    switch (message)
+    {
+        case WM_DESTROY:
+            GraphCtrl_Dispose(&PerformancePageCpuUsageHistoryGraph);
+            GraphCtrl_Dispose(&PerformancePageMemUsageHistoryGraph);
 #ifdef RUN_PERF_PAGE
-        EndLocalThread(&hPerformanceThread, dwPerformanceThread);
+            EndLocalThread(&hPerformanceThread, dwPerformanceThread);
 #endif
-        break;
+            break;
 
-    case WM_INITDIALOG:
-    {
-        BOOL bGraph;
-        TM_FORMAT fmt;
-
-        /*  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);
-        hPerformancePageCpuUsageHistoryGraph = GetDlgItem(hDlg, 
IDC_CPU_USAGE_HISTORY_GRAPH);
-
-        /*  Create the controls */
-        fmt.clrBack = RGB(0, 0, 0);
-        fmt.clrGrid = RGB(0, 128, 64);
-        fmt.clrPlot0 = RGB(0, 255, 0);
-        fmt.clrPlot1 = RGB(255, 0, 0);
-        fmt.GridCellWidth = fmt.GridCellHeight = 12;
-        fmt.DrawSecondaryPlot = TaskManagerSettings.ShowKernelTimes;
-        bGraph = GraphCtrl_Create(&PerformancePageCpuUsageHistoryGraph, 
hPerformancePageCpuUsageHistoryGraph, hDlg, &fmt);
-        if (!bGraph)
+        case WM_INITDIALOG:
         {
-            EndDialog(hDlg, 0);
-            return FALSE;
-        }
+            BOOL bGraph;
+            TM_FORMAT fmt;
 
-        fmt.clrPlot0 = RGB(255, 255, 0);
-        fmt.clrPlot1 = RGB(100, 255, 255);
-        fmt.DrawSecondaryPlot = TRUE;
-        bGraph = GraphCtrl_Create(&PerformancePageMemUsageHistoryGraph, 
hPerformancePageMemUsageHistoryGraph, hDlg, &fmt);
-        if (!bGraph)
-        {
-            EndDialog(hDlg, 0);
-            return FALSE;
-        }
+            /* Save the width and height */
+            GetClientRect(hDlg, &rc);
+            nPerformancePageWidth = rc.right;
+            nPerformancePageHeight = rc.bottom;
 
-        /*  Start our refresh thread */
-#ifdef RUN_PERF_PAGE
-        hPerformanceThread = CreateThread(NULL, 0, 
PerformancePageRefreshThread, NULL, 0, &dwPerformanceThread);
-#endif
+            /* Update window position */
+            SetWindowPos(hDlg, NULL, 15, 30, 0, 0, 
SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);
 
-        /*
-         *  Subclass graph buttons
-         */
-        OldGraphWndProc = 
(WNDPROC)SetWindowLongPtrW(hPerformancePageCpuUsageGraph, GWLP_WNDPROC, 
(LONG_PTR)Graph_WndProc);
-        SetWindowLongPtrW(hPerformancePageMemUsageGraph, 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;
-    }
+            /*
+             * Get handles to all the controls
+             */
+            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);
+
+            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);
+
+            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);
+
+            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);
+
+            /* Create the controls */
+            fmt.clrBack = RGB(0, 0, 0);
+            fmt.clrGrid = RGB(0, 128, 64);
+            fmt.clrPlot0 = RGB(0, 255, 0);
+            fmt.clrPlot1 = RGB(255, 0, 0);
+            fmt.GridCellWidth = fmt.GridCellHeight = 12;
+            fmt.DrawSecondaryPlot = TaskManagerSettings.ShowKernelTimes;
+            bGraph = GraphCtrl_Create(&PerformancePageCpuUsageHistoryGraph, 
hPerformancePageCpuUsageHistoryGraph, hDlg, &fmt);
+            if (!bGraph)
+            {
+                EndDialog(hDlg, 0);
+                return FALSE;
+            }
 
-    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;
+            fmt.clrPlot0 = RGB(255, 255, 0);
+            fmt.clrPlot1 = RGB(100, 255, 255);
+            fmt.DrawSecondaryPlot = TRUE;
+            bGraph = GraphCtrl_Create(&PerformancePageMemUsageHistoryGraph, 
hPerformancePageMemUsageHistoryGraph, hDlg, &fmt);
+            if (!bGraph)
+            {
+                EndDialog(hDlg, 0);
+                return FALSE;
+            }
+
+            /* Start our refresh thread */
+#ifdef RUN_PERF_PAGE
+            hPerformanceThread = CreateThread(NULL, 0, 
PerformancePageRefreshThread, NULL, 0, &dwPerformanceThread);
 #endif
-    case WM_SIZE:
-        do {
-        int  cx, cy;
 
-        if (wParam == SIZE_MINIMIZED)
-            return 0;
+            /*
+             * Subclass graph buttons
+             */
+            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;
+        }
 
-        cx = LOWORD(lParam);
-        cy = HIWORD(lParam);
-        nXDifference = cx - nPerformancePageWidth;
-        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);
-        AdjustCntrlPos(IDS_COMMIT_CHARGE_TOTAL, hDlg, 0, nYDifference);
-        AdjustCntrlPos(IDS_COMMIT_CHARGE_LIMIT, hDlg, 0, nYDifference);
-        AdjustCntrlPos(IDS_COMMIT_CHARGE_PEAK, hDlg, 0, nYDifference);
-        AdjustCntrlPos(IDS_KERNEL_MEMORY_TOTAL, hDlg, 0, nYDifference);
-        AdjustCntrlPos(IDS_KERNEL_MEMORY_PAGED, hDlg, 0, nYDifference);
-        AdjustCntrlPos(IDS_KERNEL_MEMORY_NONPAGED, hDlg, 0, nYDifference);
-        AdjustCntrlPos(IDS_PHYSICAL_MEMORY_TOTAL, hDlg, 0, nYDifference);
-        AdjustCntrlPos(IDS_PHYSICAL_MEMORY_AVAILABLE, hDlg, 0, nYDifference);
-        AdjustCntrlPos(IDS_PHYSICAL_MEMORY_SYSTEM_CACHE, hDlg, 0, 
nYDifference);
-        AdjustCntrlPos(IDS_TOTALS_HANDLE_COUNT, hDlg, 0, nYDifference);
-        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);
-
-        nXDifference += lastX;
-        nYDifference += lastY;
-        lastX = lastY = 0;
-        if (nXDifference % 2) {
-            if (nXDifference > 0) {
-                nXDifference--;
-                lastX++;
-            } else {
-                nXDifference++;
-                lastX--;
+        case WM_COMMAND:
+            break;
+
+        case WM_SIZE:
+        {
+            int  cx, cy;
+            int  nXDifference;
+            int  nYDifference;
+
+            if (wParam == SIZE_MINIMIZED)
+                return 0;
+
+            cx = LOWORD(lParam);
+            cy = HIWORD(lParam);
+            nXDifference = cx - nPerformancePageWidth;
+            nYDifference = cy - nPerformancePageHeight;
+            nPerformancePageWidth = cx;
+            nPerformancePageHeight = cy;
+
+            /* Reposition the performance page's controls */
+            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);
+            AdjustCntrlPos(IDS_KERNEL_MEMORY_TOTAL, hDlg, 0, nYDifference);
+            AdjustCntrlPos(IDS_KERNEL_MEMORY_PAGED, hDlg, 0, nYDifference);
+            AdjustCntrlPos(IDS_KERNEL_MEMORY_NONPAGED, hDlg, 0, nYDifference);
+            AdjustCntrlPos(IDS_PHYSICAL_MEMORY_TOTAL, hDlg, 0, nYDifference);
+            AdjustCntrlPos(IDS_PHYSICAL_MEMORY_AVAILABLE, hDlg, 0, 
nYDifference);
+            AdjustCntrlPos(IDS_PHYSICAL_MEMORY_SYSTEM_CACHE, hDlg, 0, 
nYDifference);
+            AdjustCntrlPos(IDS_TOTALS_HANDLE_COUNT, hDlg, 0, nYDifference);
+            AdjustCntrlPos(IDS_TOTALS_PROCESS_COUNT, hDlg, 0, nYDifference);
+            AdjustCntrlPos(IDS_TOTALS_THREAD_COUNT, 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)
+                {
+                    nXDifference--;
+                    lastX++;
+                }
+                else
+                {
+                    nXDifference++;
+                    lastX--;
+                }
             }
-        }
-        if (nYDifference % 2) {
-            if (nYDifference > 0) {
-                nYDifference--;
-                lastY++;
-            } else {
-                nYDifference++;
-                lastY--;
+            if (nYDifference % 2)
+            {
+                if (nYDifference > 0)
+                {
+                    nYDifference--;
+                    lastY++;
+                }
+                else
+                {
+                    nYDifference++;
+                    lastY--;
+                }
             }
+            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;
         }
-        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(hPerformancePageCpuUsageHistoryGraph, hDlg, 
nXDifference, nYDifference, 3);
-        AdjustFrameSize(hPerformancePageMemUsageHistoryGraph, hDlg, 
nXDifference, nYDifference, 4);
-        break;
     }
     return 0;
 }
@@ -295,41 +290,41 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM 
wParam, LPARAM lParam)
 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;
-    ULONGLONG  CommitChargePeak;
+    ULONGLONG CommitChargeTotal;
+    ULONGLONG CommitChargeLimit;
+    ULONGLONG CommitChargePeak;
 
-    ULONG  CpuUsage;
-    ULONG  CpuKernelUsage;
+    ULONG CpuUsage;
+    ULONG CpuKernelUsage;
 
-    ULONGLONG  KernelMemoryTotal;
-    ULONGLONG  KernelMemoryPaged;
-    ULONGLONG  KernelMemoryNonPaged;
+    ULONGLONG KernelMemoryTotal;
+    ULONGLONG KernelMemoryPaged;
+    ULONGLONG KernelMemoryNonPaged;
 
-    ULONGLONG  PhysicalMemoryTotal;
-    ULONGLONG  PhysicalMemoryAvailable;
-    ULONGLONG  PhysicalMemorySystemCache;
+    ULONGLONG PhysicalMemoryTotal;
+    ULONGLONG PhysicalMemoryAvailable;
+    ULONGLONG PhysicalMemorySystemCache;
 
-    ULONG  TotalHandles;
-    ULONG  TotalThreads;
-    ULONG  TotalProcesses;
+    ULONG TotalHandles;
+    ULONG TotalThreads;
+    ULONG TotalProcesses;
 
-    MSG    msg;
+    MSG msg;
 
-    WCHAR  Text[260];
-    WCHAR  szMemUsage[256], szCpuUsage[256], szProcesses[256];
+    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)
     {
@@ -339,32 +334,32 @@ DWORD WINAPI PerformancePageRefreshThread(void 
*lpParameter)
         WCHAR szChargeTotalFormat[256];
         WCHAR szChargeLimitFormat[256];
 
-        /*  Wait for an the event or application close */
+        /* Wait for an the event or application close */
         if (GetMessage(&msg, NULL, 0, 0) <= 0)
             return 0;
 
         if (msg.message == WM_TIMER)
         {
             /*
-             *  Update the commit charge info
+             * Update the commit charge info
              */
             CommitChargeTotal = PerfDataGetCommitChargeTotalK();
             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)
             {
@@ -374,43 +369,43 @@ DWORD WINAPI PerformancePageRefreshThread(void 
*lpParameter)
             }
 
             /*
-             *  Update the kernel memory info
+             * Update the kernel memory info
              */
             KernelMemoryTotal = PerfDataGetKernelMemoryTotalK();
             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
+             * Update the physical memory info
              */
             PhysicalMemoryTotal = PerfDataGetPhysicalMemoryTotalK();
             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
+             * Update the totals info
              */
             TotalHandles = PerfDataGetSystemHandleCount();
             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);
@@ -418,17 +413,17 @@ DWORD WINAPI PerformancePageRefreshThread(void 
*lpParameter)
             }
 
             /*
-             *  Redraw the graphs
+             * Redraw the graphs
              */
-            InvalidateRect(hPerformancePageCpuUsageGraph, NULL, FALSE);
-            InvalidateRect(hPerformancePageMemUsageGraph, NULL, FALSE);
+            InvalidateRect(hCpuUsageGraph, NULL, FALSE);
+            InvalidateRect(hMemUsageGraph, NULL, FALSE);
 
             /*
-             *  Get the CPU usage
+             * Get the CPU usage
              */
             CpuUsage = PerfDataGetProcessorUsage();
-            if (CpuUsage <= 0 )       CpuUsage = 0;
-            if (CpuUsage > 100)       CpuUsage = 100;
+            if (CpuUsage <= 0 ) CpuUsage = 0;
+            if (CpuUsage > 100) CpuUsage = 100;
 
             if (!bInMenuLoop)
             {
@@ -443,7 +438,7 @@ DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
                 CpuKernelUsage = 100;
 
             /*
-             *  Get the memory usage
+             * Get the memory usage
              */
             CommitChargeTotal = PerfDataGetCommitChargeTotalK();
             CommitChargeLimit = PerfDataGetCommitChargeLimitK();
@@ -464,13 +459,13 @@ DWORD WINAPI PerformancePageRefreshThread(void 
*lpParameter)
 
 void PerformancePage_OnViewShowKernelTimes(void)
 {
-    HMENU  hMenu;
-    HMENU  hViewMenu;
+    HMENU hMenu;
+    HMENU hViewMenu;
 
     hMenu = GetMenu(hMainWnd);
     hViewMenu = GetSubMenu(hMenu, 2);
 
-    /*  Check or uncheck the show 16-bit tasks menu item */
+    /* Check or uncheck the show 16-bit tasks menu item */
     if (GetMenuState(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND) & 
MF_CHECKED)
     {
         CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, 
MF_BYCOMMAND|MF_UNCHECKED);
@@ -490,9 +485,9 @@ void PerformancePage_OnViewShowKernelTimes(void)
 
 void PerformancePage_OnViewCPUHistoryOneGraphAll(void)
 {
-    HMENU  hMenu;
-    HMENU  hViewMenu;
-    HMENU  hCPUHistoryMenu;
+    HMENU hMenu;
+    HMENU hViewMenu;
+    HMENU hCPUHistoryMenu;
 
     hMenu = GetMenu(hMainWnd);
     hViewMenu = GetSubMenu(hMenu, 2);
@@ -504,9 +499,9 @@ void PerformancePage_OnViewCPUHistoryOneGraphAll(void)
 
 void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void)
 {
-    HMENU  hMenu;
-    HMENU  hViewMenu;
-    HMENU  hCPUHistoryMenu;
+    HMENU hMenu;
+    HMENU hViewMenu;
+    HMENU hCPUHistoryMenu;
 
     hMenu = GetMenu(hMainWnd);
     hViewMenu = GetSubMenu(hMenu, 2);
@@ -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);
 }
-
diff --git a/base/applications/taskmgr/perfpage.h 
b/base/applications/taskmgr/perfpage.h
index 181423a9610..6eed9c34e61 100644
--- a/base/applications/taskmgr/perfpage.h
+++ b/base/applications/taskmgr/perfpage.h
@@ -11,12 +11,13 @@
 extern "C" {
 #endif
 
-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);
-void   PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void);
+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);
+void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void);
 
 #ifdef __cplusplus
 };
diff --git a/base/applications/taskmgr/procpage.c 
b/base/applications/taskmgr/procpage.c
index 0af2e357831..7119e675239 100644
--- a/base/applications/taskmgr/procpage.c
+++ b/base/applications/taskmgr/procpage.c
@@ -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;
diff --git a/base/applications/taskmgr/procpage.h 
b/base/applications/taskmgr/procpage.h
index 4cab4191482..fdee980ae79 100644
--- a/base/applications/taskmgr/procpage.h
+++ b/base/applications/taskmgr/procpage.h
@@ -9,14 +9,12 @@
 
 #pragma once
 
-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 */
+extern HWND hProcessPage;           /* Process List Property Page */
+extern HWND hProcessPageListCtrl;   /* Process ListCtrl Window */
+extern HWND hProcessPageHeaderCtrl; /* Process Header Control */
 
-INT_PTR CALLBACK       ProcessPageWndProc(HWND hDlg, UINT message, WPARAM 
wParam, LPARAM lParam);
-void                           RefreshProcessPage(void);
-DWORD               GetSelectedProcessId(void);
-void                ProcessPage_OnProperties(void);
-void                ProcessPage_OnOpenFileLocation(void);
+INT_PTR CALLBACK ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, 
LPARAM lParam);
+void  RefreshProcessPage(void);
+DWORD GetSelectedProcessId(void);
+void  ProcessPage_OnProperties(void);
+void  ProcessPage_OnOpenFileLocation(void);
diff --git a/base/applications/taskmgr/trayicon.c 
b/base/applications/taskmgr/trayicon.c
index 81127a3784b..fb02d1cc88b 100644
--- a/base/applications/taskmgr/trayicon.c
+++ b/base/applications/taskmgr/trayicon.c
@@ -10,28 +10,24 @@
 
 HICON TrayIcon_GetProcessorUsageIcon(void)
 {
-    HICON     hTrayIcon = NULL;
-    HDC       hScreenDC = NULL;
-    HDC       hDC = NULL;
-    HBITMAP   hBitmap = NULL;
-    HBITMAP   hOldBitmap = NULL;
-    HBITMAP   hBitmapMask = NULL;
-    ICONINFO  iconInfo;
-    ULONG     ProcessorUsage;
-    int       nLinesToDraw;
-    HBRUSH    hBitmapBrush = NULL;
-    RECT      rc;
-
-    /*
-     * Get a handle to the screen DC
-     */
+    HICON    hTrayIcon = NULL;
+    HDC      hScreenDC = NULL;
+    HDC      hDC = NULL;
+    HBITMAP  hBitmap = NULL;
+    HBITMAP  hOldBitmap = NULL;
+    HBITMAP  hBitmapMask = NULL;
+    ICONINFO iconInfo;
+    ULONG    ProcessorUsage;
+    int      nLinesToDraw;
+    HBRUSH   hBitmapBrush = NULL;
+    RECT     rc;
+
+    /* 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;
 }
 

Reply via email to