A status bar is a horizontal home window at the bottom of a parent home window in which an applications can screen various kinds of condition information. The status bar can be separated into components to display more than one kind of information. The following display shot shows the status bar in the chrischona2015.org Windows paint application. In this case, the condition bar contains the text "For Help, click aid Topics ~ above the aid Menu". The status bar is the area in ~ the bottom of the window that contains aid text and coordinate information.

You are watching: What is a status bar in microsoft word


This section contains the complying with topics.

Types and also Styles

The default position of a condition bar is along the bottom that the parent window, however you have the right to specify the CCS_TOP layout to have it appear at the optimal of the parent window"s customer area.

You have the right to specify the SBARS_SIZEGRIP style to incorporate a sizing grip in ~ the right finish of the status bar.


Combining the CCS_TOP and also SBARS_SIZEGRIP layouts is no recommended since the result sizing tight is no functional.


Size and Height

The home window procedure for the status bar immediately sets the early size and position of the window, skipping the values mentioned in the CreateWindowEx function. The broad is the very same as the of the parent window"s customer area. The height is based upon the metrics the the font that is currently selected right into the status bar"s device context and also on the width of the window"s borders.

The home window procedure immediately adjusts the size of the status bar whenever the receives a WM_SIZE message. Typically, as soon as the dimension of the parent window changes, the parent sends out a WM_SIZE post to the standing bar.

An application can collection the minimum elevation of a status bar"s drawing area by sending the home window an SB_SETMINHEIGHT message, specifying the minimum height, in pixels. The illustration area go not incorporate the window"s borders. A minimum height is beneficial for illustration in an owner-drawn standing bar. For an ext information, watch Owner-Drawn condition Bars later in this chapter.

You retrieve the widths the the boundaries of a status bar by sending the home window an SB_GETBORDERS message. The message contains the address of a three-element selection that obtain the widths.

Multiple-Part standing Bars

A condition bar have the right to have numerous different parts, each displaying a different line of text. You divide a status bar into parts by sending out the home window an SB_SETPARTS message, point out the number of parts to create and also the attend to of an creature array. The selection contains one element for every part, and also each aspect specifies the client coordinate that the ideal edge the a part.

A standing bar have the right to have a best of 256 parts, back applications typically use far fewer than that. Girlfriend retrieve a counting of the components in a standing bar, and the coordinate of the appropriate edge of every part, by sending out the window an SB_GETPARTS message.

Status Bar message Operations

You set the text of any part of a status bar by sending out the SB_SETTEXT message, clues the zero-based table of contents of a part, an resolve of the string to draw in the part, and also the technique for illustration the string. The drawing method determines whether the text has a border and, if that does, the style of the border. It likewise determines whether the parent window is responsible for drawing the text. For an ext information, view the Owner-Drawn condition Bars section below.

By default, message is left-aligned within the specified component of a condition bar. You can embed tab characters ( t) in the text to center or right-align it. Text to the best of a single tab character is centered, and also text come the best of a 2nd tab character is right-aligned.

To retrieve message from a status bar, usage the SB_GETTEXTLENGTH and SB_GETTEXT messages.

If your application offers a standing bar that has actually only one part, you deserve to use the WM_SETTEXT, WM_GETTEXT, and WM_GETTEXTLENGTH message to do text operations. This messages deal just with the part that has actually an index of zero, allowing you to treat the standing bar lot like a static message control.

To display screen a heat of condition without creating a standing bar, use the DrawStatusText function. The function uses the same methods to draw the condition as the window procedure because that the status bar, yet it does not automatically collection the size and position of the standing information. When calling the function, you need to specify the size and also position the the standing information and the device context that the window in i beg your pardon to draw it.

Owner-Drawn condition Bars

You can specify individual parts of a standing bar to be owner-drawn parts. Utilizing this an approach gives you an ext control than you would otherwise have over the figure of the window part. Because that example, girlfriend can display screen a bitmap rather than message or draw text making use of a different font.

To specify a window part as owner-drawn, send the SB_SETTEXT message to the standing bar, clues the component and the SBT_OWNERDRAW illustration technique. When SBT_OWNERDRAW is specified, the lParam parameter is a 32-bit application-defined value that the application have the right to use when drawing the part. For example, you have the right to specify a font handle, a bitmap handle, an attend to of a string, and so on.

When a condition bar needs to draw an owner-drawn part, it sends the WM_DRAWITEM article to the parent window. The wParam parameter the the blog post is the child home window identifier of the condition bar, and also the lParam parameter is the address of a DRAWITEMSTRUCT structure. The parent home window uses the info in the structure to draw the part. For an owner-drawn component of a status bar, DRAWITEMSTRUCT consists of the following information.

CtlTypeUndefined; perform not use.
CtlIDChild home window identifier the the standing bar.
itemIDZero-based table of contents of the part to be drawn.
itemActionUndefined; execute not use.
itemStateUndefined; do not use.
hwndItemHandle come the status bar.
hDCHandle to the device context that the standing bar.
rcItemCoordinates the the window part to it is in drawn. The coordinates are family member to the top left edge of the condition bar.
itemDataApplication-defined 32-bit value specified in the lParam parameter of the SB_SETTEXT message.


Simple setting Status Bars

You put a status bar in "simple mode" by sending out it an SB_SIMPLE message. A simple mode condition bar screens only one part. Once the message of the home window is set, the home window is invalidated, however it is not redrawn until the following WM_PAINT. Wait for the blog post reduces display screen flicker by minimizing the number of times the home window is redrawn. A straightforward mode standing bar is helpful for displaying help text for food selection items when the user is scrolling through the menu.

The string the a status bar screens while in simple mode is maintained individually from the strings the it display screens while in nonsimple mode. This way you have the right to put the window in straightforward mode, collection its text, and switch back to nonsimple setting without the nonsimple mode text gift changed.

When setting the text of a an easy mode condition bar, you have the right to specify any drawing an approach except SBT_OWNERDRAW. A basic mode status bar go not support owner drawing.

Default status Bar post Processing

This section defines the messages tackled by the window procedure because that the predefined STATUSCLASSNAME class.

MessageDefault processing
WM_CREATEInitializes the standing bar.
WM_DESTROYFrees sources allocated because that the status bar.
WM_GETFONTReturns the handle to the current font with which the standing bar draws its text.
WM_GETTEXTCopies the text from the first part the a standing bar come a buffer. It return a 32-bit worth that mentions the length, in characters, of the text and the method used to draw the text.
WM_GETTEXTLENGTHReturns a 32-bit value that states the length, in characters, the the message in the an initial part that a standing bar and also the an approach used to attract the text.
WM_NCHITTESTReturns the HTBOTTOMRIGHT value if the mouse cursor is in the sizing grip, causing the mechanism to display the sizing cursor. If the mouse cursor is not in the sizing grip, the status bar passes this blog post to the DefWindowProc function.
WM_PAINTPaints the invalid region of the condition bar. If the wParam parameter is non-NULL, the manage assumes the the worth is an HDC and also paints making use of that an equipment context.
WM_SETFONTSelects the font handle right into the device context because that the condition bar.
WM_SETTEXTCopies the mentioned text right into the very first part of a status bar, making use of the default illustration operation (specified together zero). It returns TRUE if successful, or FALSE otherwise.

See more: How Many Beats Does A Sixteenth Note Get ? What To Know About The Sixteenth Note

WM_SIZEResizes the condition bar based on the current width that the parental window"s customer area and the elevation of the existing font the the standing bar.