I had the same problem and cobbled together this demo...
Code: Select all
Procedure _DwmSetWindowAttribute(hWnd, dwAttrib, *pvAttrib, cbAttrib) : EndProcedure
Prototype _DwmSetWindowAttribute(hWnd, dwAttrib, *pvAttrib, cbAttrib)
Procedure _DwmGetWindowAttribute(hWnd, dwAttrib, *pvAttrib, cbAttrib) : EndProcedure
Prototype _DwmGetWindowAttribute(hWnd, dwAttrib, *pvAttrib, cbAttrib)
dwmapi = GetModuleHandle_(@"dwmapi")
If dwmapi = 0 : dwmapi = LoadLibrary_("dwmapi") : EndIf
Function.s{32}
WideCharToMultiByte_(#CP_ACP, 0, @"DwmSetWindowAttribute", -1, @Function, #MAX_PATH, #Null, #Null)
Global DwmSetWindowAttribute__._DwmSetWindowAttribute = GetProcAddress_(dwmapi, @Function)
If DwmSetWindowAttribute__ = 0 : DwmSetWindowAttribute__ = @_DwmSetWindowAttribute() : EndIf
WideCharToMultiByte_(#CP_ACP, 0, @"DwmGetWindowAttribute", -1, @Function, #MAX_PATH, #Null, #Null)
Global DwmGetWindowAttribute__._DwmGetWindowAttribute = GetProcAddress_(dwmapi, @Function)
If DwmGetWindowAttribute__ = 0 : DwmGetWindowAttribute__ = @_DwmGetWindowAttribute() : EndIf
#DWMWA_WINDOW_CORNER_PREFERENCE = 33
#DWMWCP_DEFAULT = 0
#DWMWCP_DONOTROUND = 1
#DWMWCP_ROUND = 2
#DWMWCP_ROUNDSMALL = 3
OpenWindow(0, 0, 0, 320, 200, "win11 corner demo", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible)
ButtonGadget(0, 10, 10, 100, 30, "click me")
HideWindow(0, #False)
Repeat
event = WaitWindowEvent()
Select event
Case #PB_Event_Gadget
Select EventGadget()
Case 0
g=0
DwmGetWindowAttribute__(WindowID(0), #DWMWA_WINDOW_CORNER_PREFERENCE, @g, SizeOf(g))
Debug g
Delay(1000)
s=#DWMWCP_ROUNDSMALL
DwmSetWindowAttribute__(WindowID(0), #DWMWA_WINDOW_CORNER_PREFERENCE, @s, SizeOf(s))
DwmGetWindowAttribute__(WindowID(0), #DWMWA_WINDOW_CORNER_PREFERENCE, @g, SizeOf(g))
Debug g
Delay(1000)
s=#DWMWCP_ROUND
DwmSetWindowAttribute__(WindowID(0), #DWMWA_WINDOW_CORNER_PREFERENCE, @s, SizeOf(s))
DwmGetWindowAttribute__(WindowID(0), #DWMWA_WINDOW_CORNER_PREFERENCE, @g, SizeOf(g))
Debug g
Delay(1000)
s=#DWMWCP_DONOTROUND
DwmSetWindowAttribute__(WindowID(0), #DWMWA_WINDOW_CORNER_PREFERENCE, @s, SizeOf(s))
DwmGetWindowAttribute__(WindowID(0), #DWMWA_WINDOW_CORNER_PREFERENCE, @g, SizeOf(g))
Debug g
Delay(1000)
EndSelect
EndSelect
Until event = #PB_Event_CloseWindow