GetScrollBarInfo API don't work (1 Viewer)

pieropingi

New member
Local time
Today, 01:14
Joined
Dec 2, 2011
Messages
5
Hi all,

Somebody has a running example of GetScrollBarInfo API ? With my code, I get no results and a dll error 87.

I'm trying to know if the scrollbars (in my case, the horizontal scrollbar) are showed in the main access window. I use GetScrollBarInfo. There are 2 days I'm, searching info about the function and the parameters, but they are hard to find.
I can only find general descriptions of the API.
I found some constant values in the ApiViewer 2004.

Here is my API-calling code (in a form class-module):

'vede se la scroll bar orizzontale è visibile
Dim void As Integer
Dim SBInfo As WM_PSCROLLBARINFO

SBInfo.cbSize = Len(SBInfo)
void = WM_GetScrollBarInfo(Application.hWndAccessApp, OBJID_HSCROLL, SBInfo)

Debug.Print SBInfo.rgState(0)


After the API call:
- no error message is given. err.number is 0
- void is 0 (function not succeeded?)
- the err.LastDllError contains 87 (invalid parm?)
- all components of SBInfo are = to 0


Here are the declarations I'm using:

Type WM_Rect
Left As Long
Top As Long
Width As Long
Height As Long
End Type


'Declare Function WM_GetScrollBarInfo
'for function WM_GetScrollBarInfo, param IDObject can be:
Global Const OBJID_CLIENT As Long = &HFFFFFFFC 'the hwnd parm is a handle to a scroll bar control
Global Const OBJID_HSCROLL As Long = &HFFFFFFFA 'the horizontal scroll bar of the hwnd window
Global Const OBJID_VSCROLL As Long = &HFFFFFFFB 'the vertical scroll bar of the hwnd window
'for function WM_GetScrollBarInfo - type WM_PSCROLLBARINFO - rgState param
Global Const CCHILDREN_SCROLLBAR As Long = 5
'necessary to give a dimention to the rgState array in WM_PSCROLLBARINFO
'the 5 index of the array indicate:
'0 = The scrollbar itself
'1 = The top or right arrow button
'2 = The page up or page right region
'3 = The scroll box (thumb)
'4 = The page down or page left region
'5 = The bottom of left arrow button
'every indication can contains (can be combined?):
Private Const STATE_SYSTEM_INVISIBLE As Long = &H8000
Private Const STATE_SYSTEM_OFFSCREEN As Long = &H10000
Private Const STATE_SYSTEM_PRESSED As Long = &H8
Private Const STATE_SYSTEM_UNAVAILABLE As Long = &H1
'for function WM_GetScrollBarInfo, WM_PSCROLLBARINFO structure is:
Type WM_PSCROLLBARINFO
cbSize As Long
rcScrollBar As WM_Rect
dxyLineButton As Integer
xyTumbTop As Integer
xyTumbBottom As Integer
reserved As Integer
rgState(CCHILDREN_SCROLLBAR + 1) As Long
End Type
Declare Function WM_GetScrollBarInfo Lib "user32.dll" Alias "GetScrollBarInfo" (ByVal hwnd As Long, ByVal idObject As Long, ByRef psbi As WM_PSCROLLBARINFO) As Long

Some hint?
 

pieropingi

New member
Local time
Today, 01:14
Joined
Dec 2, 2011
Messages
5
For intrested people: I didn't got GetScrollBarInfo working, but I found a solution to know if the Access window scrollbars are visible or not. You find it here:

vbforums.com/showthread.php?p=4101744&posted=1#post4101744
 

Users who are viewing this thread

Top Bottom