Strange behaviour resolution on Asus Vivibook 15

Just starting out? Need help? Post your questions and find answers here.
MrCor
User
User
Posts: 21
Joined: Tue Dec 01, 2015 8:31 pm

Strange behaviour resolution on Asus Vivibook 15

Post by MrCor »

Hi all,

I have (at least for me) a strange behavious concerning the resolution of the screen with an Asus Vivobook 15 laptop.

When I open a window, 1920 x 1080 (as is the screenresolution) I end up with just 1540 x 840 on the screen. The rest of the window is out of reach.
I suppose the window is still 1920 x 1080 but the rest vanishes "ins blauwen Hinein".
Opening a window larger then 1540 x 840 creates the same behaviour, so it has nothing to do with opening a window with the max resolution of the screen.

I have several other computers that do not have this problem. They are all Windows 10 and this laptop is the only one that runs Windows 11. So it seems to be inherent with this particulair laptop or Windows 11.
Anyone familiar with this behaviour?

Need more info? Let me know.
Tx in advance,

Cor
Last edited by MrCor on Thu Mar 27, 2025 3:19 pm, edited 1 time in total.
fluent
User
User
Posts: 72
Joined: Sun Jan 24, 2021 10:57 am

Re: Strange behaviour resolution on Asus Vivibook 15

Post by fluent »

Check if this setting is enabled in compiler options

Image
MrCor
User
User
Posts: 21
Joined: Tue Dec 01, 2015 8:31 pm

Re: Strange behaviour resolution on Asus Vivibook 15

Post by MrCor »

Is enabled and was enabled.
MrCor
User
User
Posts: 21
Joined: Tue Dec 01, 2015 8:31 pm

Re: Strange behaviour resolution on Asus Vivibook 15

Post by MrCor »

Using this code I get 1539 and 844.

Code: Select all

If OpenWindow(0,0,0,1920,1080,"Test",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget)
  ButtonGadget(1,265,185,60,20,"Button")
  Debug WindowWidth(0)
  Debug WindowHeight(0)

  Repeat
    EventID  =WaitWindowEvent()
    If EventID=#PB_Event_Gadget And EventGadget()=1
      ResizeWindow(0,0,0,#PB_Ignore,#PB_Ignore)
      Debug WindowX(0) 
    EndIf
  Until EventID=#PB_Event_CloseWindow
EndIf
I read somewhere the DPI might have something to do with it.
Anyone can provide info if so?
breeze4me
Enthusiast
Enthusiast
Posts: 633
Joined: Thu Mar 09, 2006 9:24 am
Location: S. Kor

Re: Strange behaviour resolution on Asus Vivibook 15

Post by breeze4me »

1. Compile the code below to create an executable file.
2. Run that executable in Windows Explorer.
What result is shown in the message box?

Code: Select all

CompilerIf #PB_Compiler_DPIAware = 0
  CompilerError "Turn on DPI Aware option."
CompilerEndIf

#DWMWA_EXTENDED_FRAME_BOUNDS = 9

Import "Dwmapi.lib"
  DwmGetWindowAttribute.l(hwnd, dwAttribute.l, *pvAttribute, cbAttribute.l)
EndImport

; Prototype ptGetWindowDpiAwarenessContext(hwnd)
; Global GetWindowDpiAwarenessContext.ptGetWindowDpiAwarenessContext

Prototype ptGetDpiFromDpiAwarenessContext(value)
Global GetDpiFromDpiAwarenessContext.ptGetDpiFromDpiAwarenessContext

Prototype ptGetThreadDpiAwarenessContext()
Global GetThreadDpiAwarenessContext.ptGetThreadDpiAwarenessContext

If OpenLibrary(0, "User32.dll")
  ;GetWindowDpiAwarenessContext = GetFunction(0, "GetWindowDpiAwarenessContext")
  GetThreadDpiAwarenessContext = GetFunction(0, "GetThreadDpiAwarenessContext")
  GetDpiFromDpiAwarenessContext = GetFunction(0, "GetDpiFromDpiAwarenessContext")
EndIf

If OpenWindow(0,0,0,1920,1080,"Test",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget)
  ButtonGadget(1,265,185,60,20,"Button")
  ;Debug WindowWidth(0)
  ;Debug WindowHeight(0)
  
  If GetThreadDpiAwarenessContext
    h = GetThreadDpiAwarenessContext()
    If GetDpiFromDpiAwarenessContext
      dpi = GetDpiFromDpiAwarenessContext(h)
    EndIf
  EndIf
  
  DwmGetWindowAttribute(WindowID(0), #DWMWA_EXTENDED_FRAME_BOUNDS, @rt.RECT, SizeOf(RECT))
  w = rt\right - rt\left
  h = rt\bottom - rt\top
  
  SystemParametersInfo_(#SPI_GETWORKAREA, 0, @rt, 0)
  
  
  MessageRequester("Ctrl + C to copy", "DPI = " + dpi + #LF$ + "Frame W,H = " + w + " " + h + #LF$ + "WORKAREA = " + rt\left + " " + rt\top + " " + rt\right + " " + rt\bottom + #LF$ + "PB = " + WindowWidth(0) + " " + WindowHeight(0))
  
  Repeat
    EventID =WaitWindowEvent()
    If EventID=#PB_Event_Gadget And EventGadget()=1
      ;ResizeWindow(0,0,0,#PB_Ignore,#PB_Ignore)
      ;Debug WindowX(0)
    EndIf
  Until EventID=#PB_Event_CloseWindow
EndIf
MrCor
User
User
Posts: 21
Joined: Tue Dec 01, 2015 8:31 pm

Re: Strange behaviour resolution on Asus Vivibook 15

Post by MrCor »

Thanks Breeze4me,

To bad, it did not work.
The output I get is
---------------------------
Ctrl + C to copy
---------------------------
DPI = 120
Frame W,H = 1926 1094
WORKAREA = 0 0 1920 1080
PB = 1539 844
---------------------------
OK
---------------------------
MrCor
User
User
Posts: 21
Joined: Tue Dec 01, 2015 8:31 pm

Re: Strange behaviour resolution on Asus Vivibook 15

Post by MrCor »

Problem solved and it was very easy (if you know how).
The screen at the laptop was set to 125%. Setting it at 100% solved the problem (of course).
A bit funny maybe no-one came up with that idea (neigther did I, so I am "funny" too ;)
breeze4me
Enthusiast
Enthusiast
Posts: 633
Joined: Thu Mar 09, 2006 9:24 am
Location: S. Kor

Re: Strange behaviour resolution on Asus Vivibook 15

Post by breeze4me »

MrCor wrote: Fri Mar 28, 2025 3:13 pm The screen at the laptop was set to 125%. Setting it at 100% solved the problem (of course).
That's right. 120 (your desktop dpi) / 96 (default dpi) = 1.25 (125%) :wink:
In PB, many functions return values that reflect the scaling factor.
For example, if it is 1000 pixels wide, it will output the width as 800 (1000 / 1.25).
Last edited by breeze4me on Fri Mar 28, 2025 3:33 pm, edited 1 time in total.
miso
Enthusiast
Enthusiast
Posts: 406
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: Strange behaviour resolution on Asus Vivibook 15

Post by miso »

And with 120% this should work. (desktopunscaledx/y)

Code: Select all

ExamineDesktops()

If OpenWindow(0,0,0,DesktopUnscaledX(1920),DesktopUnscaledY(1080),"Test",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget)
  ButtonGadget(1,265,185,60,20,"Button")
  Debug WindowWidth(0)
  Debug WindowHeight(0)

  Repeat
    EventID  =WaitWindowEvent()
    If EventID=#PB_Event_Gadget And EventGadget()=1
      ResizeWindow(0,0,0,#PB_Ignore,#PB_Ignore)
      Debug WindowX(0) 
    EndIf
  Until EventID=#PB_Event_CloseWindow
EndIf
MrCor
User
User
Posts: 21
Joined: Tue Dec 01, 2015 8:31 pm

Re: Strange behaviour resolution on Asus Vivibook 15

Post by MrCor »

Do you know any commandline options to set this option? Or code in PB to set this and back?
Oops, missed your code ;)
Post Reply