How can I make the up and down arrows dissapear in a scrollbar ?

Shivang Thakur 1 Reputation point
2021-06-29T09:25:25.28+00:00

Hello
I am new to win32. I have created a simple window with a input box. It has a vertical scrollbar. I want to remove the arrows. I tried EnableScrollbar function but couldn't use it.
This is my code

hwndInputBox = CreateWindowEx(  
    0,
    L"EDIT",
    L"Yo",
    WS_BORDER | WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE,
    x / 10,
    y / 10 * 2,
    x - 2 * (x / 10) - x / 5,
    y / 4,
    m_hwnd,
    NULL, 
    (HINSTANCE)GetWindowLongPtr(m_hwnd, GWLP_HINSTANCE),
    NULL
);
SendMessage(hwndInputBox, WM_SETFONT, (WPARAM)buttonFontA, TRUE);
EnableScrollBar(hwndInputBox, SB_VERT, ESB_DISABLE_BOTH);

Please give a simple example.
Thank you

Developer technologies | C++
{count} votes

3 answers

Sort by: Most helpful
  1. Guido Franzke 2,191 Reputation points
    2021-06-29T12:09:03.023+00:00

    Hello,
    as far as I know, the standard Windows scrollbars do not have owner-draw functionality in Windows API to only remove the arrows.
    If you don't want the scroll bar in your input box, do not enable scrolling.
    Maybe, you can use this class and change the pictures of up and down arrows to empty pictures: Custom-Scrollbar-Library-version-1-1
    Regards, Guido

    Edit: here is another class: Replace-a-Window-s-Internal-Scrollbar-with-a-custo

    0 comments No comments

  2. Jeanine Zhang-MSFT 11,356 Reputation points Microsoft External Staff
    2021-06-30T02:20:16.44+00:00

    Hi,

    The EnableScrollBar function enables or disables one or both scroll bar arrows. As far as I'm concerned, the EnableScrollBar function only enable/disable the function of the scroll bar arrows but not remove the arrows.

    And in my opinion, it seems that there is no function to remove arrows.

    Best Regards,

    Jeanine


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. rupesh shukla 16 Reputation points
    2021-07-06T20:29:37.767+00:00

    I am also curious to know why you want to remove arrow , This mean you don't need scrollbar in your application and if that is the condition then don't add it at first place itself.

    Thanks

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.