Determine if a control's scrollbars are visible
Use this function to determine if the scrollbars on a control are visible.
API Declarations
'API Constants
Private Const GWL_STYLE = (-16)
Private Const WS_HSCROLL = &H100000
Private Const WS_VSCROLL = &H200000
'API Declarations
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Rate Determine if a control's scrollbars are visible
(4(4 Vote))
Private Function IsScrollBarVisible(ControlHwnd As Long) As Boolean
Dim blnResult As Boolean
Dim wndStyle As Long
'Retrieve the window style of the control.
wndStyle = GetWindowLong(ControlHwnd, GWL_STYLE)
'Test if the vertical scroll bar style is present
'in the window style, indicating that a vertical
'scroll bar is visible.
If (wndStyle And WS_VSCROLL) <> 0 Then
blnResult = True
End If
' Test if the horizontal scroll bar style is present
' in the window style, indicating that a horizontal
' scroll bar is visible.
If (wndStyle And WS_HSCROLL) <> 0 Then
blnResult = True
End If
IsScrollBarVisible = blnResult
End Function
Determine if a control's scrollbars are visible Comments
No comments yet — be the first to post one!
Post a Comment