valinet / ep_dwm

Implements a Windows service that removes the rounded corners for windows in Windows 11
GNU General Public License v2.0
49 stars 6 forks source link

Easiest way to disable rounded corners (no patching/adapter required) #3

Open limacohen opened 1 year ago

limacohen commented 1 year ago

I stumbled across this preference in PowerToys. If you just want to disable rounded corners and you don't mind using FancyZones, this is by far the easiest (official?) way to do it: "Disable round corners when window is snapped"

Meneth32 commented 2 months ago

Windows 11 rounded corners can be disabled, per-window, by calling DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, DWMWCP_DONOTROUND); (paraphrased). See: https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_window_corner_preference The remaining trick is calling this function on every window created by other processes before they're shown. PowerToys' implementation of the core call can be found here: https://github.com/microsoft/PowerToys/blob/main/src/modules/fancyzones/FancyZonesLib/WindowUtils.cpp