Help with GetScrollInfo

R

Rlrcstr

Can anyone point me to an example of using the GetScrollInfo API call from VB .NET? I've got it coded based on some stuff I've found, but I always get error 126 (The specified module could not be found.). I'm not sure if I've got the Declare wrong or the structure or what... Thanks.

Jerry

Declare:

Public Declare Function GetScrollInfo Lib "user32" Alias "GetScrollInfo" ( _
ByVal hWnd As IntPtr, _
ByVal nBar As Integer, _
<MarshalAs(UnmanagedType.Struct)> ByRef lpScrollInfo As SCROLLINFO) As Integer

Structure:

<StructLayout(LayoutKind.Sequential)> Public Structure SCROLLINFO
Public cbSize As Integer
Public fMask As Integer
Public nMin As Integer
Public nMax As Integer
Public nPage As Integer
Public nPos As Integer
Public nTrackPos As Integer
End Structure

Call:

result = GetScrollInfo(txtDisplay.Handle, SB_VERT, sInfo)
 
M

Mattias Sjögren

The declarations look correct, except that you shouls remove the
MarshalAs attribute on the lpScrollInfo parameter. It's not needed and
doesn't do what you want anyway.

Do you set the cbSize and fMask members in the sInfo correctly before
the call?



Mattias
 
R

Rlrcstr

That was it.... I forgot to set fMask. And after setting up all the
constants, too. I appreciate the feedback.

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top