There are numerous comments on the net regarding that API and windows XP. Look at the bottom of this page. Is this being used in VB6? If so, your WM_PSCROLLBARINFO structure should be using Long not Integer.
Here is a simple test to see if a scrollbar exists in a window. This applies only if the scrollbar is part of a window. If the scrollbar is a separate control within the window, the code will not work:
Assumption is that Application.hWndAccessApp is a valid window handle. It does not tell you if the scrollbar is hidden or notCode: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 Private Sub Command1_Click() Dim wndStyle As Long ' Retrieve the window style of the control. wndStyle = GetWindowLong(Application.hWndAccessApp, GWL_STYLE) ' 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 MsgBox "A horizontal scroll bar is visible." Else MsgBox "A horizontal scroll bar is NOT visible." End If ' 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 MsgBox "A vertical scroll bar is visible." Else MsgBox "A vertical scroll bar is NOT visible." End If End Sub




Reply With Quote