Strange behaviour resolution on Asus Vivibook 15
Strange behaviour resolution on Asus Vivibook 15
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
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.
Re: Strange behaviour resolution on Asus Vivibook 15
Check if this setting is enabled in compiler options


Re: Strange behaviour resolution on Asus Vivibook 15
Is enabled and was enabled.
Re: Strange behaviour resolution on Asus Vivibook 15
Using this code I get 1539 and 844.
I read somewhere the DPI might have something to do with it.
Anyone can provide info if so?
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
Anyone can provide info if so?
Re: Strange behaviour resolution on Asus Vivibook 15
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?
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
Re: Strange behaviour resolution on Asus Vivibook 15
Thanks Breeze4me,
To bad, it did not work.
The output I get is
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
---------------------------
Re: Strange behaviour resolution on Asus Vivibook 15
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
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

Re: Strange behaviour resolution on Asus Vivibook 15
That's right. 120 (your desktop dpi) / 96 (default dpi) = 1.25 (125%)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).

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.
Re: Strange behaviour resolution on Asus Vivibook 15
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
Re: Strange behaviour resolution on Asus Vivibook 15
Do you know any commandline options to set this option? Or code in PB to set this and back?
Oops, missed your code
Oops, missed your code
