A simple, small calculator placed discreetly near the Windows Taskbar or anywhere on the screen
0

Configure Feed

Select the types of activity you want to include in your feed.

fix: size calculator window client area for caption+borders; edit fills client

The window was sized to the text extent only, so the caption consumed the
whole height and the EDIT was invisible. Use AdjustWindowRectEx on the desired
client size (min 160x28), fill the client with the EDIT, shorten the title.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Marco Maroni (Jul 14, 2026, 3:43 PM +0200) 8a659fe8 a0e2d6fd

+9 -5
+9 -5
CalculatorWindow.cpp
··· 131 131 { 132 132 RECT rc = { 0, 0, 220, 48 }; 133 133 // Top-level popup, always-on-top, tool window (no taskbar/Alt-Tab button). 134 - HWND hwnd = __super::Create(NULL, rc, L"Taskbar Calculator", 134 + HWND hwnd = __super::Create(NULL, rc, L"Calculator", 135 135 WS_POPUP | WS_CAPTION | WS_SYSMENU, 136 136 WS_EX_TOPMOST | WS_EX_TOOLWINDOW); 137 137 if (!hwnd) return FALSE; 138 138 139 139 m_hwndEdit = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("EDIT"), TEXT("0"), 140 - WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | ES_RIGHT | ES_NUMBER, 140 + WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | ES_RIGHT, 141 141 0, 0, 0, 0, m_hWnd, NULL, _AtlBaseModule.GetModuleInstance(), 0); 142 142 143 143 SetWindowFont(m_hwndEdit, m_ptrVisualStyle->GetFont(), TRUE); ··· 145 145 if (wpOrigEditProc == 0) return FALSE; 146 146 ::SetWindowLongPtr(m_hwndEdit, GWLP_USERDATA, (LONG_PTR)this); 147 147 148 + // Size so the CLIENT area fits the display, accounting for caption + borders. 148 149 POINTL ideal = CalcIdealSize(); 149 - SetWindowPos(NULL, 0, 0, ideal.x + 24, ideal.y + 16, SWP_NOMOVE | SWP_NOZORDER); 150 + LONG clientW = ideal.x + 24; if (clientW < 160) clientW = 160; 151 + LONG clientH = ideal.y + 14; if (clientH < 28) clientH = 28; 152 + RECT r = { 0, 0, clientW, clientH }; 153 + AdjustWindowRectEx(&r, WS_POPUP | WS_CAPTION | WS_SYSMENU, FALSE, WS_EX_TOOLWINDOW); 154 + SetWindowPos(NULL, 0, 0, r.right - r.left, r.bottom - r.top, SWP_NOMOVE | SWP_NOZORDER); 150 155 PlaceInitial(); 151 156 return TRUE; 152 157 } ··· 298 303 // const UINT defaultHeight = 22; 299 304 //#endif 300 305 301 - UINT defaultHeight = (rc.bottom - rc.top) / 2; 302 - ::SetWindowPos(m_hwndEdit, 0, rc.left, ((rc.bottom - rc.top - defaultHeight) / 2), rc.right, defaultHeight, SWP_SHOWWINDOW); 306 + ::SetWindowPos(m_hwndEdit, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW | SWP_NOZORDER); 303 307 304 308 return 0; 305 309 }