Page 1 of 1
[PB6.10b4] Full-size window displays wrongly (Windows 11?)
Posted: Thu Feb 01, 2024 12:13 am
by marcoagpinto
Heya,
Code: Select all
If OpenWindow(1,0,0,10,10,"Getting Maximum Window Size",#PB_Window_Maximize|#PB_Window_Invisible)=0 : MessageRequester("Error", "Can't open a window.",#PB_MessageRequester_Error) : EndIf
MARCOAGPINTO_max_width=WindowWidth(1)
CloseWindow(1)
If OpenWindow(1,0,0,10,10,"Getting Maximum Window Size",#PB_Window_Maximize|#PB_Window_Invisible)=0 : MessageRequester("Error", "Can't open a window.",#PB_MessageRequester_Error) : EndIf
MARCOAGPINTO_max_height=WindowHeight(1)
CloseWindow(1)
If OpenWindow(1,0,0,MARCOAGPINTO_max_width,MARCOAGPINTO_max_height,"Testing PureBasic 6.10 beta 4",#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)=#False : MessageRequester("Error", "Can't open a window.", #PB_MessageRequester_Error) : EndIf
WindowBounds(1,MARCOAGPINTO_max_width,MARCOAGPINTO_max_height,#PB_Ignore,#PB_Ignore)
ResizeWindow(1,0,0,MARCOAGPINTO_max_width,MARCOAGPINTO_max_height)
test=WaitWindowEvent()
Delay(10000)
It hides the Windows 11 taskbar, and it doesn't fit all to the left, letting you see the desktop slightly.
Screenshot in FULL-HD here:
https://justpaste.it/axonk
Re: [PB6.10b4] Full-size window displays wrongly (Windows 11?)
Posted: Sun Feb 04, 2024 9:21 am
by Fred
You will need to use | #PB_Window_MaximizeGadget as well to get proper height.
For Window left issue, I don't know yet how to fix it (and if we need to) as Windows seems to consider the sizing border as part of the window size. More info on this:
https://stackoverflow.com/questions/507 ... ce-created
https://stackoverflow.com/questions/341 ... le-borders
Re: [PB6.10b4] Full-size window displays wrongly (Windows 11?)
Posted: Sun Feb 04, 2024 10:54 am
by marcoagpinto
But, Fred, in PB 6.04 there wasn't this window left issue.
Re: [PB6.10b4] Full-size window displays wrongly (Windows 11?)
Posted: Sun Feb 04, 2024 10:55 am
by marcoagpinto
Can one of our experts suggest how to fix it?
There are beautiful minds in this forum.
Re: [PB6.10b4] Full-size window displays wrongly (Windows 11?)
Posted: Tue Feb 06, 2024 2:27 pm
by breeze4me
marcoagpinto wrote: Sun Feb 04, 2024 10:55 am
Can one of our experts suggest how to fix it?
There are beautiful minds in this forum.
Workaround:
Code: Select all
Enumeration 1 ;DWMWINDOWATTRIBUTE
#DWMWA_NCRENDERING_ENABLED
#DWMWA_NCRENDERING_POLICY
#DWMWA_TRANSITIONS_FORCEDISABLED
#DWMWA_ALLOW_NCPAINT
#DWMWA_CAPTION_BUTTON_BOUNDS
#DWMWA_NONCLIENT_RTL_LAYOUT
#DWMWA_FORCE_ICONIC_REPRESENTATION
#DWMWA_FLIP3D_POLICY
#DWMWA_EXTENDED_FRAME_BOUNDS
#DWMWA_HAS_ICONIC_BITMAP
#DWMWA_DISALLOW_PEEK
#DWMWA_EXCLUDED_FROM_PEEK
#DWMWA_CLOAK
#DWMWA_CLOAKED
#DWMWA_FREEZE_REPRESENTATION
#DWMWA_LAST
EndEnumeration
Prototype.l DwmSetWindowAttribute(hwnd, dwAttribute.l, *pvAttribute, cbAttribute.l)
Prototype.l DwmGetWindowAttribute(hwnd, dwAttribute.l, *pvAttribute, cbAttribute.l)
Global DwmSetWindowAttribute__.DwmSetWindowAttribute
Global DwmGetWindowAttribute__.DwmGetWindowAttribute
SystemParametersInfo_(#SPI_GETWORKAREA, 0, @rt.RECT, 0)
If OpenLibrary(0, "Dwmapi.dll")
DwmSetWindowAttribute__ = GetFunction(0, "DwmSetWindowAttribute")
DwmGetWindowAttribute__ = GetFunction(0, "DwmGetWindowAttribute")
EndIf
hWnd = OpenWindow(0, 0, 0, 200, 100, "", #PB_Window_SystemMenu | #PB_Window_Invisible)
If hWnd
n = #True
If DwmSetWindowAttribute__(hWnd, #DWMWA_CLOAK, @n, SizeOf(n)) <> #S_OK
Debug "error 1"
EndIf
HideWindow(0, 0)
GetWindowRect_(hWnd, @rtEntireFrame.RECT)
DwmGetWindowAttribute__(hWnd, #DWMWA_EXTENDED_FRAME_BOUNDS, @rtFrame.RECT, SizeOf(RECT))
CloseWindow(0)
LeftMargin = rtFrame\left - rtEntireFrame\left
RightMargin = rtEntireFrame\right - rtFrame\right
TopMargin = rtFrame\top - rtEntireFrame\top
BottomMargin = rtEntireFrame\bottom - rtFrame\bottom
EndIf
hWnd = OpenWindow(0, 0, 0, 0, 0, "test", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_Invisible)
MoveWindow_(hWnd, -LeftMargin, -TopMargin, rt\right - rt\left + LeftMargin + RightMargin, rt\bottom - rt\top + TopMargin + BottomMargin, 1)
HideWindow(0, 0)
If CreateStatusBar(0, WindowID(0))
AddStatusBarField(190)
StatusBarText(0, 0, "test text")
EndIf
Repeat
e = WaitWindowEvent()
Until e = #PB_Event_CloseWindow
CloseLibrary(0)
Re: [PB6.10b4] Full-size window displays wrongly (Windows 11?)
Posted: Wed Feb 07, 2024 10:24 am
by Marco2007
Everything is okay here, when using #PB_Window_SizeGadget.
Code: Select all
If OpenWindow(1,0,0,10,10,"Getting Maximum Window Size",#PB_Window_Maximize|#PB_Window_Invisible| #PB_Window_MinimizeGadget | #PB_Window_Maximize )=0 : MessageRequester("Error", "Can't open a window.",#PB_MessageRequester_Error) : EndIf
MARCOAGPINTO_max_width=WindowWidth(1)
CloseWindow(1)
If OpenWindow(1,0,0,10,10,"Getting Maximum Window Size",#PB_Window_Maximize|#PB_Window_Invisible| #PB_Window_MinimizeGadget | #PB_Window_Maximize )=0 : MessageRequester("Error", "Can't open a window.",#PB_MessageRequester_Error) : EndIf
MARCOAGPINTO_max_height=WindowHeight(1)
CloseWindow(1)
If OpenWindow(1,0,0,MARCOAGPINTO_max_width,MARCOAGPINTO_max_height,"Testing PureBasic 6.10 beta 4",#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_SizeGadget)=#False : MessageRequester("Error", "Can't open a window.", #PB_MessageRequester_Error) : EndIf
WindowBounds(1,MARCOAGPINTO_max_width,MARCOAGPINTO_max_height,#PB_Ignore,#PB_Ignore)
ResizeWindow(1,0,0,MARCOAGPINTO_max_width,MARCOAGPINTO_max_height)
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_CloseWindow
Quit = 1
EndIf
Until Quit = 1
Re: [PB6.10b4] Full-size window displays wrongly (Windows 11?)
Posted: Wed Feb 07, 2024 10:32 am
by marcoagpinto
@Fred!!!
Please look at marco2007 post:
seems to fix it. What does this constant do? If it is harmless, could you make it work under the hood (no need to type it)?