Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


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

EnableScrollBar (user32)
 
.
Summary

C# Signature:

[DllImport("user32.dll")]
static extern bool EnableScrollBar(IntPtr hWnd, uint wSBflags, uint wArrows);

VB Signature:

<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function EnableScrollBar(ByVal hWnd As IntPtr, ByVal wSBflags As UInteger, ByVal wArrows As UInteger) As Boolean
End Function

User-Defined Types:

    Private Enum SBFlags
    SB_HORZ = 0
    SB_VERT = 1
    SB_CTL = 2
    SB_BOTH = 3
    End Enum

    Private 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
    End Enum

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

    [Flags]
    enum SBTYPES
    {
        SB_HORZ = 0,
        SB_VERT = 1,
        SB_CTL = 2,
        SB_BOTH = 3
    }
    [Flags]
    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);

    void DisableHScrollBar(Control control)
    {
        IntPtr controlPtr = (IntPtr)control.Handle.ToInt32();
        EnableScrollBar(controlPtr, (uint)SBTYPES.SB_HORZ, (uint)SBArrows.ESB_DISABLE_BOTH);

    }

Alternative Managed API:

Do you know one? Please contribute it!

Documentation

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 PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions