r/Windhawk • u/wh-updates • 1d ago
Remove UWP titlebars 2.1.0
Remove UWP titlebars 2.1.0
- Merge changes by user o12r (show maximize and minimize buttons when the theme is active):
Fixes missing caption buttons when using this mod (only tested on Windows 11 25H2, build 26200). With 2.0.1 the native titlebar shows title and icon but no minimize/maximize/close.
Root cause
- All buttons hidden: ApplicationFrameHost calls
SetWindowThemeAttribute(WTA_NONCLIENT)on the frame with flags0x10007/ mask0x1000F. The undocumented bit0x10000makes DWM drop all caption buttons (stock UWP frames draw their own). Logged in AFH: DWM caption-button width goes from 49 → 0 on exactly that call. - Only close returns after fixing (1): frames are created with
CreateWindowInBandExtype flags0x3. Bit0x1makes the window "immersive", and uDWM'sCTopLevelWindow::GetCurrentStyleadds close but skips minimize/maximize whenCWindowData::IsImmersiveWindow()is true. Changing the type flags in AFH is not an option: clearing either bit stops the app'sCoreWindowfrom being hosted in the frame (tested all combinations).
Changes (v2.1.0)
- AFH: hook
SetWindowThemeAttributeand strip0x10000forApplicationFrameWindow; on load, clear it on frames this mod already converted. - AFH:
WM_NCHITTEST/ NC button messages forHTMINBUTTON/HTMAXBUTTON/HTCLOSEgo toDefWindowProc, so hit-testing, hover and clicks follow DWM's actual button rects instead of the UWP layout. - dwm.exe (new
@include): hookCTopLevelWindow::GetCurrentStyleand add the min/maxNCAREA_FLAGSbits (0x100|0x200+ enabled0x1000/0x2000, same as the non-immersive path) only when the window already has a close button, is immersive, and hasWS_CAPTION|WS_SYSMENU+ min/max boxes. Stock UWP frames keep0x10000, never get the close bit, and are unaffected.
Notes
- The dwm.exe part reads the style from
CWindowData+0x74(asGetCurrentStyledoes on uDWM 10.0.26100). It is sanity-checked, so on other builds it should be a no-op (close button only) rather than misbehave. - Tested with OpenGlass (Win7 theme) and with OpenGlass stopped: Calculator and Settings show all three buttons, content is hosted normally, buttons respond.
1
Upvotes