Open limacohen opened 1 year ago
Interesting, looks like it's possible to set this on a per-window basis using DwmSetWindowAttribute + DWM_WINDOW_CORNER_PREFERENCE.
I wonder if this could get rid of the need for running with elevation. One minor issue I see with this method is the need to install a window hook or have a thread polling to account for new windows. This is also only (officially) supported starting with build 22000.
Interesting, looks like it's possible to set this on a per-window basis using DwmSetWindowAttribute + DWM_WINDOW_CORNER_PREFERENCE.
I wonder if this could get rid of the need for running with elevation. One minor issue I see with this method is the need to install a window hook or have a thread polling to account for new windows.
You cannot get around elevation. As a principle, an app cannot “alter” another app which is on a higher privilege level.
ExplorerPatcher already uses this API for Simple Windows Switcher’s “corner” preference.
The thing with this API is that making use of it reliably is more cumbersome:
So yeah, idk, I wouldn’t call this easy at all. The method employed by ep_dwm (ExplorerPatcher) is the technically correct strategy. Rounded corners appeared only since around build 22000, so I don’t see the problem here - this API works basically since Windows 11 RTM, like the Mica backdrop brush and so on.
So yeah, idk, I wouldn’t call this easy at all.
I mean, it's easy from the user point of view. I already use FancyZones so I just had to click a checkbox. I'm sure this would be the case for other people too. I assume the window hook was already in place for moving/resizing the windows.
Just to be clear, I enormously appreciate the effort done by both of you guys. I'm just shedding some light into an alternative way to get to the same(ish) thing.
So yeah, idk, I wouldn’t call this easy at all.
I mean, it's easy from the user point of view. I already use FancyZones so I just had to click a checkbox. I'm sure this would be the case for other people too. I assume the window hook was already in place for moving/resizing the windows.
Just to be clear, I enormously appreciate the effort done by both of you guys. I'm just shedding some light into an alternative way to get to the same(ish) thing.
Yeah, idk, as I said, no doubt it can work. Everybody can decide what works best for them. I looked on FancyZones: the fact that it is a first party product yet it employs so many hacks against their own operating system says a lot about how friendly developing on Windows has become.
As I said, it probably runs some elevated agent in order to apply the property to elevated windows. Do PowerToys require admin when installing…?
I agree that this method does require more work to get working perfectly and it's not really worth the effort.
You cannot get around elevation. As a principle, an app cannot “alter” another app which is on a higher privilege level.
Well you can get a window handle to every process without elevation, that's what motivated my thinking here. Taking a quick glance at DwmSetWindowAttribute there is some access checks happening in win32k, cba to look into it any further though.
As I said, it probably runs some elevated agent in order to apply the property to elevated windows. Do PowerToys require admin when installing…?
The installer seems to schedule an elevated task. Being MSFT they could even digitally sign using Windows Publisher and casually bypass UAC prompts (autoElevate) if they chose to. I think it's quite sad that just wanting to install an app to be run as admin is such a hassle on this platform.
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: