SetScrollInfo (user32)
Last changed: -202.74.138.1

.
Summary

C# Signature:

[DllImport("user32.dll")]
static extern int SetScrollInfo(IntPtr hwnd, int fnBar, [In] ref SCROLLINFO
   lpsi, bool fRedraw);

VB.Net Signature:

  <DllImport("user32.dll")> _
  Public Function SetScrollInfo(ByVal hWnd As IntPtr, ByVal fnBar As ScrollBarDirection, _
    ByRef lpsi As SCROLLINFO, ByVal bRepaint As Boolean) As Integer
  End Function

User-Defined Types:

    //fnBar values
    enum SBTYPES
    {
        SB_HORZ = 0,
        SB_VERT = 1,
        SB_CTL = 2,
        SB_BOTH = 3
    }
    //lpsi values
    enum LPCSCROLLINFO
    {
       SIF_RANGE = 0x0001,
       SIF_PAGE = 0x0002,
       SIF_POS = 0x0004,
       SIF_DISABLENOSCROLL = 0x0008,
       SIF_TRACKPOS = 0x0010,
       SIF_ALL = (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS)
    }

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

<br>

SCROLLINFO scrollinfo = new SCROLLINFO();

scrollinfo.cbSize = Marshal.SizeOf( typeof(SCROLLINFO) );

scrollinfo.fMask = Convert.ToInt32(LPCSCROLLINFO.SIF_RANGE);

scrollinfo.nMin = 0;

scrollinfo.nMax = 4;

SetScrollInfo( MyControl.Handle, (int) SBTYPES.SB_VERT, ref scrollinfo, true );

</br>

Alternative Managed API:

Do you know one? Please contribute it!

Documentation
SeeAlso