I have routine that checks users resolution and adjust the form height using this:

Code:
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Const SM_CXSCREEN = 0
Private Const SM_CYMAXIMIZED = 62

Public Const SM_CXFULLSCREEN = 16
Public Const SM_CYFULLSCREEN = 17


Public Sub MaxFormHeight(frm As Form)
Dim lgScreenY As Long

  lgScreenY = GetSystemMetrics(SM_CYMAXIMIZED)
  frm.Height = Screen.Height - lgScreenY  
End Sub



Detect taskbar height

I have routine that checks users resolution and adjust the form height using this:
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Const SM_CXSCREEN = 0
Private Const SM_CYMAXIMIZED = 62

Public Const SM_CXFULLSCREEN = 16
Public Const SM_CYFULLSCREEN = 17


Public Sub MaxFormHeight(frm As Form)
Dim lgScreenY As Long
 lgScreenY = GetSystemMetrics(SM_CYMAXIMIZED)
  frm.Height = Screen.Height - lgScreenY  
End Sub
I am not concerned with the forms width only the height. This works fine until a user increases the taskbar height. Then when the form loads it does not allow for the increased height of the taskbar. The taskbar then covers the bottom portion of the form. How can i correct this ?