[PB6.10b4] Full-size window displays wrongly (Windows 11?)

Just starting out? Need help? Post your questions and find answers here.
User avatar
marcoagpinto
Addict
Addict
Posts: 1076
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

[PB6.10b4] Full-size window displays wrongly (Windows 11?)

Post 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
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [PB6.10b4] Full-size window displays wrongly (Windows 11?)

Post 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
User avatar
marcoagpinto
Addict
Addict
Posts: 1076
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: [PB6.10b4] Full-size window displays wrongly (Windows 11?)

Post by marcoagpinto »

Fred wrote: Sun Feb 04, 2024 9:21 am 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
But, Fred, in PB 6.04 there wasn't this window left issue.
User avatar
marcoagpinto
Addict
Addict
Posts: 1076
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: [PB6.10b4] Full-size window displays wrongly (Windows 11?)

Post by marcoagpinto »

Can one of our experts suggest how to fix it?

There are beautiful minds in this forum.
breeze4me
Enthusiast
Enthusiast
Posts: 633
Joined: Thu Mar 09, 2006 9:24 am
Location: S. Kor

Re: [PB6.10b4] Full-size window displays wrongly (Windows 11?)

Post 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)
Marco2007
Enthusiast
Enthusiast
Posts: 648
Joined: Tue Jun 12, 2007 10:30 am
Location: not there...

Re: [PB6.10b4] Full-size window displays wrongly (Windows 11?)

Post 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
PureBasic for Windows
User avatar
marcoagpinto
Addict
Addict
Posts: 1076
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: [PB6.10b4] Full-size window displays wrongly (Windows 11?)

Post by marcoagpinto »

Fred wrote: Sun Feb 04, 2024 9:21 am 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
@Fred!!!

Please look at marco2007 post:

Code: Select all

#PB_Window_SizeGadget
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)?
Post Reply