Hi,
I'm using the following code to detect whether a scrollbar (horizontal/vertical) is displayed in Access form/control:
Then, I'm calling the functions on a form with a button:Code:Option Compare Database Option Explicit Private Const GWL_STYLE = (-16) Private Const WS_HSCROLL = &H100000 Private Const WS_VSCROLL = &H200000 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 If End Function
Problem is, the result is always 'False', even if I shrink the form to display a scrollbar.Code:Private Sub Command1_Click() MsgBox IsVScrollVisible(Me.Hwnd) MsgBox IsHScrollVisible(Me.Hwnd) 'MsgBox IsVScrollVisible(Forms!Form1.Hwnd) 'Direct pointer doesn't work either 'MsgBox IsHScrollVisible(Forms!Form1.Hwnd) ' End Sub
I would appreciate an insight as to any errors in my approach, thank you.


Reply With Quote



