Desktop Functions:

   Smart Device Functions:

Show Recent Changes
Subscribe (RSS)
Misc. Pages
Helpful Tools
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
enablescrollbar (user32)

C# Signature:

static extern bool EnableScrollBar(IntPtr hWnd, uint wSBflags, uint wArrows);

VB.NET Signature:

<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function EnableScrollBar(ByVal hWnd As IntPtr, <MarshalAs(UnmanagedType.U4)>wSBflags As SBFlags, <MarshalAs(UnmanagedType.U4)>wArrows As SBArrows) As <MarshalAs(UnmanagedType.Bool)>Boolean
End Function

VB Signature

Public Declare Function EnableScrollBar Lib "user32" _
         (ByVal hWnd As Long, _
          ByVal wSBflags As SBFlags, _
          ByVal wArrows As SBArrows) As Long

User-Defined Types:

SBFlags, SBArrows



Tips & Tricks:

Please add some!

Sample Code:

Disables the HScroll bar for a specified control.

Works on all types that inherit from Control.

C# Code Snippet

    enum SBTYPES
        SB_HORZ = 0,
        SB_VERT = 1,
        SB_CTL = 2,
        SB_BOTH = 3
    enum SBArrows
        ESB_ENABLE_BOTH = 0,
        ESB_DISABLE_BOTH = 3,
        ESB_DISABLE_LEFT = 1,
        ESB_DISABLE_RIGHT = 2,
        ESB_DISABLE_UP = 1,
        ESB_DISABLE_DOWN = 2,
        ESB_DISABLE_LTUP = 1,
        ESB_DISABLE_RTDN = 2
    [DllImport("user32.dll", SetLastError = true)]
    static extern bool EnableScrollBar(IntPtr hWnd, uint wSBflags, uint wArrows);

    private void DisableHScrollBar(Control control)
        EnableScrollBar(control.Handle, (uint)SBTYPES.SB_HORZ, (uint)SBArrows.ESB_DISABLE_BOTH);


Alternative Managed API:

Do you know one? Please contribute it!


Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

Access directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version