I'm writing a program and I need that the height of the main window to be the full height just above the taskbar by 3 pixels (I like to see the lower edge), and I have two laptops with different scales, so I need support for scale also, I tried the following, it works well only when I substract twice the taskbar height not once (in this case the lower part is hidden), which is curious, unless there is something wrong on my system.
Any help is appreciated.
my display is 17": 1600*900, scale=1.2 and 1, using W10, PB6.11
Code: Select all
EnableExplicit
Define kx.d, ky.d, DesktopRect.RECT, wid.u, hei.u
Define top.u, bottom.u, left.u, right.u, taskbar.u
Define heiw.u, widw.u
kx=1/DesktopResolutionX()
ky=1/DesktopResolutionY()
ExamineDesktops()
SystemParametersInfo_(#SPI_GETWORKAREA, 0, @DesktopRect.RECT, 0)
left= DesktopRect\left
top= DesktopRect\top
right= DesktopRect\right
bottom= DesktopRect\bottom
wid=DesktopWidth(0)
hei=DesktopHeight(0)
Debug wid
Debug hei
Debug left
Debug top
Debug right
Debug bottom
taskbar=hei-bottom
Debug taskbar
widw=0.5*wid*kx
;heiw=(hei-2*taskbar)*ky-3 ; this is good
heiw=(hei-taskbar)*ky-3 ; this is bad
OpenWindow(0,left*kx,0,widw,heiw,"Test",#PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
Repeat: Until WaitWindowEvent() = #PB_Event_CloseWindow
CloseDebugOutput()

