An up-down control is a pair of arrow buttons that the user can click to increment or decrement a value, such as a scroll position or a number displayed in a companion control. The value associated with an up-down control is called its current position. An up-down control is most often used with a companion control, which is called a buddy window.
To the user, an up-down control and its buddy window often look like a single control. You can specify that an up-down control automatically position itself next to its buddy window and that it automatically set the caption of the buddy window to its current position. For example, you can use an up-down control with an edit control to prompt the user for numeric input. The following illustration shows an up-down control with an edit control as its buddy window, a combination that is sometimes referred to as a spinner control.
![]()
An up-down control without a buddy window functions as a sort of simplified scroll bar. For example, a tab control sometimes displays an up-down control to enable the user to scroll additional tabs into view. The following illustration shows an up-down control in the upper-right corner of a tab control.

You can create an up-down control and specify its buddy window in several
ways. The
The UPDOWN_CLASS window class is registered when the common controls
dynamic-link library (DLL) is loaded. If you create an up-down control without
using the CreateUpDownControl function, you must ensure that the DLL is
loaded. You can do so by using the
CreateUpDownControl enables you to specify a buddy window. If you
create an up-down control without using this function, you can assign a buddy
window by specifying the
An up-down control notifies its parent window when its current position
changes by sending it a
The following topics are discussed in this section.
Using window styles, you can manipulate characteristics of an up-down control, such as how it positions itself relative to its buddy window, whether it sets the text of its buddy window, and whether it processes the UP ARROW and DOWN ARROW keys.
An up-down control with the
An up-down control with the
You can specify the
If you use an up-down control for horizontal scrolling, you can specify the UDS_HORZ style. This style causes the up-down control's arrows to point left and right instead of up and down.
By default, the current position does not change if the user attempts to
increment it or decrement it beyond the maximum or minimum value. You can change
this behavior by using the
After an up-down control is created, you can change the control's current position, minimum position, and maximum position by sending messages. You can also change the radix base used to display the current position in the buddy window and the rate at which the current position changes when the up or down arrow is clicked.
To retrieve the current position of an up-down control, use the
The buddy window's caption may be either a decimal or hexadecimal string,
depending on the radix base (that is, either base 10 or 16) of the up-down
control. You can set the radix base by using the
The
You can change the minimum and maximum positions of an up-down control by
using the
You can control the rate at which the position changes when the user holds
down an arrow button by setting the up-down control's acceleration. The
acceleration is defined by an array of
This section describes the standard Windows messages processed by an up-down control.
| Message | Processing performed |
|---|---|
| Allocates and initializes a private data structure and saves its address as window data. | |
| Frees data allocated during WM_CREATE processing. | |
| Invalidates the window. | |
| Changes the current position in the case of an UP ARROW or DOWN ARROW key. | |
| Completes the position change. | |
| Captures the mouse. If the buddy window is an edit control or list box, it sets the focus to the buddy window. If the mouse is over the up or down button, it begins changing the position and sets a timer. | |
| Completes the position change and releases the mouse capture if the up-down control has captured the mouse. If the buddy window is an edit control, it selects all the text in the edit control. | |
| Paints the up-down control. If the wParam parameter is non-NULL, the control assumes that the value is an HDC and paints using that device context. | |
| Changes the current position if the mouse is being held down over a button and a sufficient interval has elapsed. |
Up-down controls in Microsoft® Internet Explorer support the following new feature.
| Full 32-bit Range |
| The up-down control now supports a full 32-bit range. The |