GetScrollBarInfo API don't work

pieropingi

New Member
Joined
Dec 2, 2011
Messages
2
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. :oops:
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? :pray:
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,216,404
Messages
6,130,376
Members
449,578
Latest member
TT123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top