I am trying to set the width of a Msflexgrid based on if it has a vertical scrollbar
Code:
The first time this Function is called it is false(this is correct)
The second time it reports true even though its not visible
Why is this ?
Code:
Code:
Const GWL_STYLE = (-16)
Const WS_VSCROLL = &H200000
Const WS_HSCROLL = &H100000
Private Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" ( _
ByVal Hwnd As Long, _
ByVal nIndex As Long) As Long
'==================================================================
Public Function IsHScrollVisible(Hwnd As Long) As Boolean
Dim Style As Long
Style = GetWindowLong(Hwnd, GWL_STYLE)
If (Style And WS_HSCROLL) Then
IsHScrollVisible = True
Exit Function
End If
End Function
'==================================================================
Public Function IsVScrollVisible(Hwnd As Long) As Boolean
Dim Style As Long
Style = GetWindowLong(Hwnd, GWL_STYLE)
If (Style And WS_VSCROLL) Then
IsVScrollVisible = True
Exit Function
End I
End Function
Sub PositionForm_Grid
gridStats.Width = 12184
If IsVScrollVisible(gridStats.Hwnd) = False Then
gridStats.Width = 11800
End If
The second time it reports true even though its not visible
Why is this ?