Toolbar

This section contains information about the programming elements used with toolbar controls.

Overviews

Topic Contents
About Toolbar Controls A toolbar is a control that contains one or more buttons. Each button, when clicked by a user, sends a command message to the parent window. Typically, the buttons in a toolbar correspond to items in the application's menu, providing an additional and more direct way for the user to access an application's commands.
Using Toolbar Controls This topic contains implementation details and example code for using toolbar controls in your applications.

Functions

Topic Contents
CreateMappedBitmap Creates a bitmap for use in a toolbar.
CreateToolbarEx Creates a toolbar window and adds the specified buttons to the toolbar. Note: This function is deprecated, because it does not support all features of toolbars. Use CreateWindowEx instead. For examples, see Using Toolbar Controls.

Messages

Topic Contents
TB_ADDBITMAP Adds one or more images to the list of button images available for a toolbar.
TB_ADDBUTTONS Adds one or more buttons to a toolbar.
TB_ADDSTRING Adds a new string to the toolbar's string pool.
TB_AUTOSIZE Causes a toolbar to be resized.
TB_BUTTONCOUNT Retrieves a count of the buttons currently in the toolbar.
TB_BUTTONSTRUCTSIZE Specifies the size of the TBBUTTON structure.
TB_CHANGEBITMAP Changes the bitmap for a button in a toolbar.
TB_CHECKBUTTON Checks or unchecks a given button in a toolbar.
TB_COMMANDTOINDEX Retrieves the zero-based index for the button associated with the specified command identifier.
TB_CUSTOMIZE Displays the Customize Toolbar dialog box.
TB_DELETEBUTTON Deletes a button from the toolbar.
TB_ENABLEBUTTON Enables or disables the specified button in a toolbar.
TB_GETANCHORHIGHLIGHT Retrieves the anchor highlight setting for a toolbar.
TB_GETBITMAP Retrieves the index of the bitmap associated with a button in a toolbar.
TB_GETBITMAPFLAGS Retrieves the flags that describe the type of bitmap to be used.
TB_GETBUTTON Retrieves information about the specified button in a toolbar.
TB_GETBUTTONINFO Retrieves extended information for a button in a toolbar.
TB_GETBUTTONSIZE Retrieves the current width and height of toolbar buttons, in pixels.
TB_GETBUTTONTEXT Retrieves the display text of a button on a toolbar.
TB_GETCOLORSCHEME Retrieves the color scheme information from the toolbar control.
TB_GETDISABLEDIMAGELIST Retrieves the image list that a toolbar control uses to display inactive buttons.
TB_GETEXTENDEDSTYLE Retrieves the extended styles for a toolbar control.
TB_GETHOTIMAGELIST Retrieves the image list that a toolbar control uses to display hot buttons.
TB_GETHOTITEM Retrieves the index of the hot item in a toolbar.
TB_GETIDEALSIZE Gets the ideal size of the toolbar.
TB_GETIMAGELIST Retrieves the image list that a toolbar control uses to display buttons in their default state. A toolbar control uses this image list to display buttons when they are not hot or disabled.
TB_GETIMAGELISTCOUNT Gets the number of image lists associated with the toolbar.
TB_GETINSERTMARK Retrieves the current insertion mark for the toolbar.
TB_GETINSERTMARKCOLOR Retrieves the color used to draw the insertion mark for the toolbar.
TB_GETITEMDROPDOWNRECT Gets the bounding rectangle of the dropdown window for a toolbar item with style BTNS_DROPDOWN.
TB_GETITEMRECT Retrieves the bounding rectangle of a button in a toolbar.
TB_GETMAXSIZE Retrieves the total size of all of the visible buttons and separators in the toolbar.
TB_GETMETRICS Retrieves the metrics of a toolbar control.
TB_GETOBJECT Retrieves the IDropTarget for a toolbar control.
TB_GETPADDING Retrieves the padding for a toolbar control.
TB_GETPRESSEDIMAGELIST Gets the image list that a toolbar control uses to display buttons in a pressed state.
TB_GETRECT Retrieves the bounding rectangle for a specified toolbar button.
TB_GETROWS Retrieves the number of rows of buttons in a toolbar with the TBSTYLE_WRAPABLE style.
TB_GETSTATE Retrieves information about the state of the specified button in a toolbar, such as whether it is enabled, pressed, or checked.
TB_GETSTRING Retrieves a string from a toolbar's string pool.
TB_GETSTYLE Retrieves the styles currently in use for a toolbar control.
TB_GETTEXTROWS Retrieves the maximum number of text rows that can be displayed on a toolbar button.
TB_GETTOOLTIPS Retrieves the handle to the tooltip control, if any, associated with the toolbar.
TB_GETUNICODEFORMAT Retrieves the Unicode character format flag for the control.
TB_HASACCELERATOR Intended for internal use; not recommended for use in applications.
Retrieves a count of toolbar buttons that have the specified accelerator character.
TB_HIDEBUTTON Hides or shows the specified button in a toolbar.
TB_HITTEST Determines where a point lies in a toolbar control.
TB_INDETERMINATE Sets or clears the indeterminate state of the specified button in a toolbar.
TB_INSERTBUTTON Inserts a button in a toolbar.
TB_INSERTMARKHITTEST Retrieves the insertion mark information for a point in a toolbar.
TB_ISBUTTONCHECKED Determines whether the specified button in a toolbar is checked.
TB_ISBUTTONENABLED Determines whether the specified button in a toolbar is enabled.
TB_ISBUTTONHIDDEN Determines whether the specified button in a toolbar is hidden.
TB_ISBUTTONHIGHLIGHTED Checks the highlight state of a toolbar button.
TB_ISBUTTONINDETERMINATE Determines whether the specified button in a toolbar is indeterminate.
TB_ISBUTTONPRESSED Determines whether the specified button in a toolbar is pressed.
TB_LOADIMAGES Loads system-defined button images into a toolbar control's image list.
TB_MAPACCELERATOR Determines the ID of the button that corresponds to the specified accelerator character.
TB_MARKBUTTON Sets the highlight state of a given button in a toolbar control.
TB_MOVEBUTTON Moves a button from one index to another.
TB_PRESSBUTTON Presses or releases the specified button in a toolbar.
TB_REPLACEBITMAP Replaces an existing bitmap with a new bitmap.
TB_SAVERESTORE Send this message to initiate saving or restoring a toolbar state.
TB_SETANCHORHIGHLIGHT Sets the anchor highlight setting for a toolbar.
TB_SETBITMAPSIZE Sets the size of the bitmapped images to be added to a toolbar.
TB_SETBOUNDINGSIZE Intended for internal use; not recommended for use in applications.
Sets the bounding size for a multi-column toolbar control.
TB_SETBUTTONINFO Sets the information for an existing button in a toolbar.
TB_SETBUTTONSIZE Sets the size of buttons on a toolbar.
TB_SETBUTTONWIDTH Sets the minimum and maximum button widths in the toolbar control.
TB_SETCMDID Sets the command identifier of a toolbar button.
TB_SETCOLORSCHEME Sets the color scheme information for the toolbar control.
TB_SETDISABLEDIMAGELIST Sets the image list that the toolbar control will use to display disabled buttons.
TB_SETDRAWTEXTFLAGS Sets the text drawing flags for the toolbar.
TB_SETEXTENDEDSTYLE Sets the extended styles for a toolbar control.
TB_SETHOTIMAGELIST Sets the image list that the toolbar control will use to display hot buttons.
TB_SETHOTITEM Sets the hot item in a toolbar.
TB_SETHOTITEM2 Sets the hot item in a toolbar.
TB_SETIMAGELIST Sets the image list that the toolbar uses to display buttons that are in their default state.
TB_SETINDENT Sets the indentation for the first button in a toolbar control.
TB_SETINSERTMARK Sets the current insertion mark for the toolbar.
TB_SETINSERTMARKCOLOR Sets the color used to draw the insertion mark for the toolbar.
TB_SETLISTGAP Sets the distance between the toolbar buttons on a specific toolbar.
TB_SETMAXTEXTROWS Sets the maximum number of text rows displayed on a toolbar button.
TB_SETMETRICS Sets the metrics of a toolbar control.
TB_SETPADDING Sets the padding for a toolbar control.
TB_SETPARENT Sets the window to which the toolbar control sends notification codes.
TB_SETPRESSEDIMAGELIST Sets the image list that the toolbar uses to display buttons that are in a pressed state.
TB_SETROWS Sets the number of rows of buttons in a toolbar.
TB_SETSTATE Sets the state for the specified button in a toolbar.
TB_SETSTYLE Sets the style for a toolbar control.
TB_SETTOOLTIPS Associates a tooltip control with a toolbar.
TB_SETUNICODEFORMAT Sets the Unicode character format flag for the control. This message allows you to change the character set used by the control at run time rather than having to re-create the control.
TB_SETWINDOWTHEME Sets the visual style of a toolbar control.
TB_TRANSLATEACCELERATOR Passes a keyboard message to the toolbar.

Notifications

Topic Contents
NM_CHAR (toolbar) Sent by the toolbar when it receives a WM_CHAR message. This notification code is sent in the form of a WM_NOTIFY message.
NM_CLICK (toolbar) Sent by a toolbar control when the user clicks an item with the left mouse button. This notification code is sent in the form of a WM_NOTIFY message.
NM_CUSTOMDRAW (toolbar) Sent by the toolbar to notify its parent window about drawing operations. This notification code is sent in the form of a WM_NOTIFY message.
NM_DBLCLK (toolbar) Notifies the parent window of a toolbar control that the user has double-clicked the left mouse button within the control. This notification code is sent in the form of a WM_NOTIFY message.
NM_KEYDOWN (toolbar) Sent by a control when the control has the keyboard focus and the user presses a key. This notification code is sent in the form of a WM_NOTIFY message.
NM_LDOWN Notifies a toolbar's parent window that the left mouse button has been pressed. This notification code is sent in the form of a WM_NOTIFY message.
NM_RCLICK (toolbar) Sent by a toolbar control when the user clicks the toolbar with the right mouse button. This notification code is sent in the form of a WM_NOTIFY message.
NM_RDBLCLK (toolbar) Notifies a control's parent window that the user has double-clicked the right mouse button within the control. This notification code is sent in the form of a WM_NOTIFY message.
NM_RELEASEDCAPTURE (toolbar) Notifies a toolbar control's parent window that the control is releasing mouse capture. This notification code is sent in the form of a WM_NOTIFY message.
NM_TOOLTIPSCREATED (toolbar) Notifies a toolbar's parent window that the toolbar has created a tooltip control. This notification code is sent in the form of a WM_NOTIFY message.
TBN_BEGINADJUST Notifies a toolbar's parent window that the user has begun customizing a toolbar. This message code is sent in the form of a WM_NOTIFY message.
TBN_BEGINDRAG Notifies a toolbar's parent window that the user has begun dragging a button in a toolbar. This notification code is sent in the form of a WM_NOTIFY message.
TBN_CUSTHELP Notifies a toolbar's parent window that the user has chosen the Help button in the Customize Toolbar dialog box. This notification code is sent in the form of a WM_NOTIFY message.
TBN_DELETINGBUTTON Sent by a toolbar control when a button is about to be deleted.
TBN_DRAGOUT Sent by a toolbar control when the user clicks a button and then moves the cursor off the button. This notification code is sent in the form of a WM_NOTIFY message.
TBN_DRAGOVER Ascertains whether a TB_MARKBUTTON message should be sent for a button that is being dragged over. This notification code is sent in the form of a WM_NOTIFY message.
TBN_DROPDOWN Sent by a toolbar control when the user clicks a dropdown button. This notification code is sent in the form of a WM_NOTIFY message.
TBN_DUPACCELERATOR Ascertains whether an accelerator key can be used on two or more active toolbars. This notification code is sent in the form of a WM_NOTIFY message.
TBN_ENDADJUST Notifies a toolbar's parent window that the user has stopped customizing a toolbar. This notification code is sent in the form of a WM_NOTIFY message.
TBN_ENDDRAG Notifies the toolbar's parent window that the user has stopped dragging a button in a toolbar. This notification code is sent in the form of a WM_NOTIFY message.
TBN_GETBUTTONINFO Retrieves toolbar customization information and notifies the toolbar's parent window of any changes being made to the toolbar. This notification code is sent in the form of a WM_NOTIFY message.
TBN_GETDISPINFO Retrieves display information for a toolbar item. This notification is sent in the form of a WM_NOTIFY message.
TBN_GETINFOTIP Retrieves infotip information for a toolbar item. This notification code is sent in the form of a WM_NOTIFY message.
TBN_GETOBJECT Sent by a toolbar control that uses the TBSTYLE_REGISTERDROP style to request a drop target object when the pointer passes over one of its buttons. This notification code is sent in the form of a WM_NOTIFY message.
TBN_HOTITEMCHANGE Sent by a toolbar control when the hot (highlighted) item changes. This notification code is sent in the form of a WM_NOTIFY message.
TBN_INITCUSTOMIZE Notifies a toolbar's parent window that customizing has started. This notification code is sent in the form of a WM_NOTIFY message.
TBN_MAPACCELERATOR Requests the index of the button in the toolbar corresponding to the specified accelerator character. This notification code is sent in the form of a WM_NOTIFY message.
TBN_QUERYDELETE Notifies the toolbar's parent window whether a button may be deleted from a toolbar while the user is customizing the toolbar. This notification code is sent in the form of a WM_NOTIFY message.
TBN_QUERYINSERT Notifies the toolbar's parent window whether a button may be inserted to the left of the specified button while the user is customizing a toolbar. This notification code is sent in the form of a WM_NOTIFY message.
TBN_RESET Notifies the toolbar's parent window that the user has reset the content of the Customize Toolbar dialog box. This notification code is sent in the form of a WM_NOTIFY message.
TBN_RESTORE Notifies a toolbar's parent window that a toolbar is in the process of being restored. This notification code is sent in the form of a WM_NOTIFY message.
TBN_SAVE Notifies a toolbar's parent window that a toolbar is in the process of being saved. This notification code is sent in the form of a WM_NOTIFY message.
TBN_TOOLBARCHANGE Notifies the toolbar's parent window that the user has customized a toolbar. This notification code is sent in the form of a WM_NOTIFY message.
TBN_WRAPACCELERATOR Requests the index of the button in one or more toolbars corresponding to the specified accelerator character. This notification code is sent in the form of a WM_NOTIFY message.
TBN_WRAPHOTITEM Notifies an application with two or more toolbars that the hot item is about to change. This notification code is sent in the form of a WM_NOTIFY message.

Structures

Topic Contents
COLORMAP Contains information used by the CreateMappedBitmap function to map the colors of the bitmap.
NMTBCUSTOMDRAW Contains information specific to an NM_CUSTOMDRAW notification code sent by a toolbar control.
NMTBDISPINFO Contains and receives display information for a toolbar item. This structure is used with the TBN_GETDISPINFO notification code.
NMTBGETINFOTIP Contains and receives infotip information for a toolbar item. This structure is used with the TBN_GETINFOTIP notification code.
NMTBHOTITEM Contains information used with the TBN_HOTITEMCHANGE notification code.
NMTBRESTORE Allows applications to extract the information that was placed in NMTBSAVE when the toolbar state was saved. This structure is passed to applications when they receive a TBN_RESTORE notification code.
NMTBSAVE This structure is passed to applications when they receive a TBN_SAVE notification code. It contains information about the button currently being saved. Applications can modify the values of the members to save additional information.
NMTOOLBAR Contains information used to process toolbar notification codes. This structure supersedes the TBNOTIFY structure.
TBADDBITMAP Adds a bitmap that contains button images to a toolbar.
TBBUTTON Contains information about a button in a toolbar.
TBBUTTONINFO Contains or receives information for a specific button in a toolbar.
TBINSERTMARK Contains information on the insertion mark in a toolbar control.
TBMETRICS Defines the metrics of a toolbar that are used to shrink or expand toolbar items.
TBREPLACEBITMAP Used with the TB_REPLACEBITMAP message to replace one toolbar bitmap with another.
TBSAVEPARAMS Specifies the location in the registry where the TB_SAVERESTORE message stores and retrieves information about the state of a toolbar.

Constants

Topic Contents
Toolbar Button States This section lists the states a toolbar button can have.
Toolbar Control and Button Styles The following window styles are specific to toolbars. They are combined with other window styles when the toolbar is created.
Note For Common Controls version 6.00, if a visual style is being used with the toolbar, buttons are always transparent regardless of the style setting. Otherwise, transparency behavior is normal as indicated by the use of the TBSTYLE_FLAT or TBSTYLE_TRANSPARENT style. Note: Comctl32.dll version 6 is not redistributable but it is included in Windows or later. To use Comctl32.dll version 6, specify it in a manifest. For more information on manifests, see Enabling Visual Styles.
Toolbar Extended Styles This section lists the extended styles supported by toolbar controls.
Toolbar Standard Button Image Index Values This section specifies index values of images within standard bitmaps.