WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: Jeremy Whilde on February 04, 2017, 02:59:55 AM

Title: Get height of Taskbar
Post by: Jeremy Whilde on February 04, 2017, 02:59:55 AM
I need to sit a dialog on top of the taskbar whatever the resolution of the monitor being used, at 1920x 1080 the taskbar seems to be 18 units tall, not sure if these are pixels or WB screen units or something else. So I thought I would try and write a function as below using WinMetrics to get the height of the taskbar, this however does not see to return 18 units is there a reliable way to do this?

Thanks JW

;===========================================================
; Get height of taskbar ??
;===========================================================

#DefineFunction tbHeight()
               FullHeight = WinMetrics(17) ;/WinMetrics(-5) ; To convert to Winbatch screen units???
               Height  = WinMetrics(1)                ;/WinMetrics(-5)
                a = Height - FullHeight
                Return a
#EndFunction


; Set window position to lower right corner if no XY position stored (First start position)
;MyDialogWidth=064
MyDialogHeight=021      ; Need this because dialog code is after this
ScreenWidth = WinMetrics(0)
ScreenHeight = WinMetrics(1)
PpHDU = WinMetrics(-6)
PpVDU = WinMetrics(-5)

;Lower Right
;MyDialogX = int(Floor(ScreenWidth/PpHDU-MyDialogWidth))
retvalue = int(Floor( ( ScreenHeight - WinMetrics(4))/PpVDU-MyDialogHeight)) -18 ;- tbHeight()
Title: Re: Get height of Taskbar
Post by: ....IFICantBYTE on February 05, 2017, 03:23:15 PM
Try searching for "taskbar" in the Tech Database and things like the following articles should help...

W18459 GetWorkArea Window Resize

W17711 Areo Window Borders Issue