VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Determine if a control's scrollbars are visible

by chabber (2 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

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

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

Download this snippet    Add to My Saved Code

Determine if a control's scrollbars are visible Comments

No comments have been posted about Determine if a control's scrollbars are visible. Why not be the first to post a comment about Determine if a control's scrollbars are visible.

Post your comment

Subject:
Message:
0/1000 characters