Determine if a control's scrollbars are visible
Use this function to determine if the scrollbars on a control are visible.
Original Author: chabber
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
Code
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
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.