Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form sizing to fill screen dimensions minus taskbar

Tags:

vb6

How do you size your form in vb6 so that form lower border is at top of taskbar

like image 297
kjack Avatar asked Jan 05 '09 14:01

kjack


1 Answers

Is there a reason you cannot just maximise the form? That would be my first impression.

If that's not a runner, you could try getting the taskbar height in the following way:

Private Const ABM_GETTASKBARPOS = &H5

Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Type APPBARDATA
    cbSize As Long
    hwnd As Long
    uCallbackMessage As Long
    uEdge As Long
    rc As RECT
    lParam As Long
End Type

Private Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long


Function GetTaskBarSize()
    Dim ABD As APPBARDATA

    SHAppBarMessage ABM_GETTASKBARPOS, ABD

    MsgBox "Width:" & ABD.rc.Right - ABD.rc.Left 
    MsgBox " Height:" & ABD.rc.Bottom -    ABD.rc.Top

End Sub

and then setting your form's height to the screen's height less the taskbar's height.

like image 116
Galwegian Avatar answered Sep 22 '22 20:09

Galwegian