NM_KEYDOWN (toolbar)
Toolbar Control Reference

NM_KEYDOWN (toolbar)


NM_KEYDOWN
    lpnmk = (LPNMKEY) lParam;

Sent by a control when the control has the keyboard focus and the user presses a key. This notification message is sent in the form of a WM_NOTIFY message.

lpnmk
Address of an NMKEY structure that contains additional information about the key that caused the notification message.

Currently, only the toolbar control sends this notification.

Version 4.71

NM_RCLICK (toolbar)

NM_RCLICK
    lpnmmouse = (LPNMMOUSE) lParam;

Sent by a toolbar control when the user clicks on the toolbar with the right mouse button. This notification message is sent in the form of a WM_NOTIFY message.

lpnmmouse
Address of an NMMOUSE structure that contains information about this notification. If the mouse was clicked on a toolbar item, the dwItemSpec member contains the item identifier and the dwItemData member contains the item data. If the mouse was clicked on a separator or white space in the toolbar, the dwItemSpec member will contain -1.

This notification is identical to the standard NM_RCLICK notification except that the toolbar supplies an NMMOUSE structure instead of an NMHDR structure for the lParam.

Version 4.71. Prior versions send a standard NM_RCLICK message.

NM_RDBLCLK (toolbar)

NM_RDBLCLK 
    lpnmh = (LPNMHDR) lParam; 

Notifies a control's parent window that the user has double-clicked the right mouse button within the control. NM_RDBLCLK is sent in the form of a WM_NOTIFY message.

lpnmh
Address of an NMHDR structure that contains additional information about this notification message.

NM_RELEASEDCAPTURE (toolbar)

NM_RELEASEDCAPTURE
    lpnmh = (LPNMHDR) lParam; 

Notifies a toolbar control's parent window that the control is releasing mouse capture. This notification is sent in the form of a WM_NOTIFY message.

lpnmh
Address of an NMHDR structure that contains additional information about this notification message.

Version 4.71.

TBN_BEGINADJUST

TBN_BEGINADJUST 
    lpnmhdr = (LPNMHDR) lParam; 

Notifies a toolbar's parent window that the user has begun customizing a toolbar. This message is sent in the form of a WM_NOTIFY message.

lpnmhdr
Address of an NMHDR structure that contains information about the notification message.

TBN_BEGINDRAG

TBN_BEGINDRAG 
    lpnmtb = (LPNMTOOLBAR) lParam; 

Notifies a toolbar's parent window that the user has begun dragging a button in a toolbar. This message is sent in the form of a WM_NOTIFY message.

lpnmtb
Address of an NMTOOLBAR structure. The iItem member contains the command identifier of the button being dragged.

TBN_CUSTHELP

TBN_CUSTHELP 
    lpnmhdr = (LPNMHDR) lParam; 

Notifies a toolbar's parent window that the user has chosen the Help button in the Customize Toolbar dialog box. This message is sent in the form of a WM_NOTIFY message.

lpnmhdr
Address of an NMHDR structure that contains information about the notification message.

TBN_DELETINGBUTTON

 TBN_DELETINGBUTTON 
    lpnmtb = (LPNMTOOLBAR) lParam;

Sent by a toolbar control when a button is about to be deleted.

lpnmtb
Address of an NMTOOLBAR structure that contains information about the button being deleted. For this notification message, only the hdr and iItem members of this structure are valid. The iItem member of this structure contains the command identifier of the button being deleted.

Version 4.71

TBN_DRAGOUT

TBN_DRAGOUT
    lpnmtb = (LPNMTOOLBAR) lParam;

Sent by a toolbar control when the user clicks a button and then moves the cursor off the button. This notification message is sent in the form of a WM_NOTIFY message.

lpnmtb
Address of an NMTOOLBAR structure that contains information about this notification. For this notification message, only the hdr and iItem members of this structure are valid. The iItem member of this structure contains the command identifier of the button being dragged.

This notification allows an application to implement drag-and-drop functionality for toolbar buttons. When processing this notification, the application will begin the drag-and-drop operation.

Version 4.71

TBN_DROPDOWN

TBN_DROPDOWN
    lpnmtb = (LPNMTOOLBAR) lParam;

Sent by a toolbar control when the user clicks a button that uses the TBSTYLE_DROPDOWN style. This notification message is sent in the form of a WM_NOTIFY message.

lpnmtb
Address of an NMTOOLBAR structure that contains information about this notification. For this notification message, only the hdr and iItem members of this structure are valid.

In version 4.71 and greater, this notification is only sent when the user clicks on the drop-down arrow portion of the button. In previous versions, this notification is sent when the user clicks on any portion of the button.

Version 4.70

TBN_ENDADJUST

TBN_ENDADJUST 
    lpnmhdr = (LPNMHDR) lParam; 

Notifies a toolbar's parent window that the user has stopped customizing a toolbar. This message is sent in the form of a WM_NOTIFY message.

lpnmhdr
Address of an NMHDR structure that contains information about the notification message.

TBN_ENDDRAG

TBN_ENDDRAG 
    lpnmtb = (LPNMTOOLBAR) lParam; 

Notifies the toolbar's parent window that the user has stopped dragging a button in a toolbar. This message is sent in the form of a WM_NOTIFY message.

lpnmtb
Address of an NMTOOLBAR structure. The iItem member contains the command identifier of the button being dragged.

TBN_GETBUTTONINFO

TBN_GETBUTTONINFO 
    lpnmtb = (LPNMTOOLBAR) lParam; 

Retrieves toolbar customization information and notifies the toolbar's parent window of any changes being made to the toolbar. This is sent in the form of a WM_NOTIFY message.

lpnmtb
Address of an NMTOOLBAR structure. The iItem member specifies a zero-based index that provides a count of the buttons the Customize Toolbar dialog box displays as both available and present on the toolbar.

The pszText member specifies the address of the current button text, and cchText specifies its length in characters. The application should fill the structure with information about the button.

The toolbar control allocates a buffer, and the receiver (parent window) must copy the text into that buffer. The cchText member contains the length of the buffer allocated by the toolbar when TBN_GETBUTTONINFO is sent to the parent window.

TBN_GETDISPINFO

TBN_GETBUTTONINFO 
    lptbdi = (LPNMTBDISPINFO) lParam; 

Retrieves display information for a toolbar item. This notification is sent in the form of a WM_NOTIFY message.

lptbdi
Address of an NMTBDISPINFO structure. The idCommand member specifies the item's command identifier, the lParam member contains the item's application-defined data, and the dwMask member specifies what information is being requested.

TBN_GETOBJECT

TBN_GETOBJECT
    lpnmon = (LPNMOBJECTNOTIFY) lParam;

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.

lpnmon
Address of an NMOBJECTNOTIFY structure that contains information about the button that the pointer passed over and receives data the application provides in response to this message.

To provide an object, an application must set values in some members of the NMOBJECTNOTIFY structure at lpnmon. The pObject member must be set to a valid object pointer, and the hResult member must be set to a success flag. To comply with Component Object Model (COM) standards, always increment the object's reference count when providing an object pointer.

If an application does not provide an object, it must set pObject to NULL and hResult to a failure flag.

Version 4.71

TBN_HOTITEMCHANGE

TBN_HOTITEMCHANGE
    lpnmhi = (LPNMTBHOTITEM) lParam;

Sent by a toolbar control when the hot (highlighted) item changes. This notification message is sent in the form of a WM_NOTIFY message.

lpnmhi
Address of an NMTBHOTITEM structure that contains information about this notification.

Version 4.71

TBN_QUERYDELETE

TBN_QUERYDELETE 
    lpnmtb = (LPNMTOOLBAR) lParam; 

Notifies the toolbar's parent window whether a button may be deleted from a toolbar while the user is customizing the toolbar. This message is sent in the form of a WM_NOTIFY message.

lpnmtb
Address of an NMTOOLBAR structure. The iItem member contains the zero-based index of the button to be deleted.

TBN_QUERYINSERT

TBN_QUERYINSERT 
    lpnmtb = (LPNMTOOLBAR) lParam; 

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 message is sent in the form of a WM_NOTIFY message.

lpnmtb
Address of an NMTOOLBAR structure. The iItem member contains the zero-based index of the button to be inserted.

TBN_RESET

TBN_RESET 
    lpnmhdr = (LPNMHDR) lParam; 

Notifies the toolbar's parent window that the user has reset the content of the Customize Toolbar dialog box. This message is sent in the form of a WM_NOTIFY message.

lpnmhdr
Address of an NMHDR structure that contains information about the notification message.

TBN_TOOLBARCHANGE

TBN_TOOLBARCHANGE 
    lpnmhdr = (LPNMHDR) lParam; 

Notifies the toolbar's parent window that the user has customized a toolbar. This message is sent in the form of a WM_NOTIFY message.

lpnmhdr
Address of an NMHDR structure that contains information about the notification message.

Toolbar Control Structures

This section contains information about the structures used with toolbar controls.

COLORMAP

typedef struct _COLORMAP { 
    COLORREF from; 
    COLORREF to; 
} COLORMAP, FAR* LPCOLORMAP; 
 

Contains information used by the CreateMappedBitmap function to map the colors of the bitmap.

from
Color to map from.
to
Color to map to.

NMTBCUSTOMDRAW

typedef struct _NMTBCUSTOMDRAW {
    NMCUSTOMDRAW nmcd;
    HBRUSH hbrMonoDither;
    HBRUSH hbrLines;
    HPEN hpenLines;
    COLORREF clrText;
    COLORREF clrMark;
    COLORREF clrTextHighlight;
    COLORREF clrBtnFace;
    COLORREF clrBtnHighlight;
    COLORREF clrHighlightHotTrack;
    RECT rcText;
    int nStringBkMode;
    int nHLStringBkMode;
} NMTBCUSTOMDRAW, * LPNMTBCUSTOMDRAW;

Contains information specific to an NM_CUSTOMDRAW notification message sent by a toolbar control.

nmcd
NMCUSTOMDRAW structure that contains general custom draw information. The uItemState member of this structure can be modified so that a toolbar item will be drawn in the specified state without actually changing the item's state.
hbrMonoDither
HBRUSH that the control will use when drawing the background of marked or dithered items. This member is ignored if TBCDRF_NOMARK is returned from the NM_CUSTOMDRAW notification.
hbrLines
HBRUSH that the control will use when drawing lines on the buttons.
hpenLines
HPEN that the control will use when drawing lines on the buttons.
clrText
COLORREF that represents the color that the control will use when drawing text on normal items.
clrMark
COLORREF that represents the background color that the control will use when drawing text on marked items.
clrTextHighlight
COLORREF that represents the color that the control will use when drawing text on highlighted items.
clrBtnFace
COLORREF that represents the face color that the control will use when drawing buttons.
clrBtnHighlight
COLORREF that represents the face color that the control will use when drawing highlighted items. An item is highlighted if it has the TBSTATE_MARKED style and is contained in a toolbar that has the TBSTYLE_FLAT style.
clrHighlightHotTrack
COLORREF that represents the background color that the control will use when drawing text on hot tracked items. This member is ignored if TBCDRF_HILITEHOTTRACK is not returned from the NM_CUSTOMDRAW notification.
rcText
RECT structure that, on entry, contains the rectangle of the item's text. The right and bottom members of this structure can be modified to change the width and height, respectively, of the text rectangle of the item.
nStringBkMode
Specifies the background mode that the control will use when drawing the text of a nonhighlighted item. This can be either the TRANSPARENT or OPAQUE value.
nHLStringBkMode
Specifies the background mode that the control will use when drawing the text of a highlighted item. This can be either the TRANSPARENT or OPAQUE value.

Version 4.71

NMTBDISPINFO

typedef struct{
    NMHDR  hdr;
    DWORD dwMask;
    int idCommand;
    DWORD lParam;
    int iImage;
    LPTSTR pszText;
    int cchText;
} NMTBDISPINFO, *LPNMTBDISPINFO;

Contains and receives display information for a toolbar item. This structure is used with the TBN_GETDISPINFO notification.

hdr
NMHDR structure that contains additional information about the notification message.
dwMask
Set of flags that indicate which members of this structure are being requested. This can be one or more of the following values:
TBNF_IMAGE The item's image index is being requested. The image index must be placed in the iImage member.
TBNF_TEXT Not currently implemented. The item's text is being requested. The text must be copied to the buffer pointed to by the pszText member.

The receiving application can add the TBNF_DI_SETITEM flag to this member, in which case the control will store the display information and not request it again.

idCommand
The command identifier of the item for which display information is being requested. This member is filled in by the control before sending the notification.
lParam
The application-defined 32-bit value associated with the item for which display information is being requested. This member is filled in by the control before sending the notification.
iImage
Receives the image index for the item.
pszText
Address of a character buffer that receives the item's text.
cchText
Size of the buffer, in characters, at pszText.

Version 4.71

NMTBHOTITEM

typedef struct tagNMTBHOTITEM {
    NMHDR hdr;
    int idOld;
    int idNew;
    DWORD dwFlags;
} NMTBHOTITEM, FAR* LPNMTBHOTITEM;

Contains information used with the TBN_HOTITEMCHANGE notification.

hdr
NMHDR structure that contains additional information about the notification message.
idOld
Command identifier of the previously highlighted item.
idNew
Command identifier of the item about to be highlighted.
dwFlags
Flags that indicate why the hot item has changed. This can be one or more of the following values:
HICF_ACCELERATOR The change in the hot item resulted from an accelerator.
HICF_ARROWKEYS The change in the hot item resulted from an arrow key.
HICF_DUPACCEL Modifies HICF_ACCELERATOR. If this flag is set, more than one item has the same accelerator character.
HICF_ENTERING Modifies the other reason flags. If this flag is set, there is no previous hot item and idOld does not contain valid information.
HICF_LEAVING Modifies the other reason flags. If this flag is set, there is no new hot item and idNew does not contain valid information.
HICF_MOUSE The change in the hot item resulted from a mouse event.
HICF_OTHER The change in the hot item resulted from an event that could not be determined. This will most often be due to a change in focus or the TB_SETHOTITEM message.
HICF_RESELECT The change in the hot item resulted from the user entering the accelerator for an item that was already hot.

Version 4.71

NMTOOLBAR

typedef struct tagNMTOOLBAR {
    NMHDR    hdr;
    int      iItem;
    TBBUTTON tbButton;
    int      cchText;
    LPTSTR   pszText;
} NMTOOLBAR, FAR* LPNMTOOLBAR;

Contains information used to process toolbar notification messages. This structure supersedes the TBNOTIFY structure.

hdr
NMHDR structure that contains additional information about the notification message.
iItem
Command identifier of the button associated with the notification.
tbButton
TBBUTTON structure that contains information about the toolbar button associated with the notification. This member only contains valid information with the TBN_QUERYINSERT and TBN_QUERYDELETE notifications.
cchText
Count of characters in the button text.
pszText
Address of a character buffer that contains the button text.

Version 4.70

TBADDBITMAP

typedef struct {
    HINSTANCE hInst; 
    UINT nID; 
} TBADDBITMAP, *LPTBADDBITMAP; 

Adds a bitmap that contains button images to a toolbar.

hInst
Handle to the module instance with the executable file that contains a bitmap resource. You can add the system-defined button bitmaps to the list by specifying HINST_COMMCTRL as the hInst member and one of the following values as the nID member:
IDB_STD_LARGE_COLOR Adds large, color standard bitmaps.
IDB_STD_SMALL_COLOR Adds small, color standard bitmaps.
IDB_VIEW_LARGE_COLOR Adds large, color view bitmaps.
IDB_VIEW_SMALL_COLOR Adds small, color view bitmaps.
For more information about the system-defined standard and view bitmaps, see the comments at the end of this reference.
nID
Resource identifier of the bitmap resource that contains the button images. If hInst is NULL, this parameter must be the handle to a bitmap that contains the button images.

The Windows header files provide the following values to be used as indexes to the standard and view bitmaps.
STD_COPY Specifies the copy image.
STD_CUT Specifies the cut image.
STD_DELETE Specifies the delete image.
STD_FILENEW Specifies the new file image.
STD_FILEOPEN Specifies the open file image.
STD_FILESAVE Specifies the save file image.
STD_FIND Specifies the find image.
STD_HELP Specifies the help image.
STD_PASTE Specifies the paste image.
STD_PRINT Specifies the print image.
STD_PRINTPRE Specifies the print preview image.
STD_PROPERTIES Specifies the properties image.
STD_REDOW Specifies the redo image.
STD_REPLACE Specifies the replace image.
STD_UNDO Specifies the undo image.
VIEW_DETAILS Specifies the view details image.
VIEW_LARGEICONS Specifies the view large icons image.
VIEW_LIST Specifies the view list image.
VIEW_SMALLICONS Specifies the view small icons image.
VIEW_SORTDATE Specifies the sort by date image.
VIEW_SORTNAME Specifies the sort by name image.
VIEW_SORTSIZE Specifies the sort by size image.
VIEW_SORTTYPE Specifies the sort by type image.

The TBADDBITMAP structure is used with the TB_ADDBITMAP message.

TBBUTTON

typedef struct _TBBUTTON {
    int iBitmap; 
    int idCommand; 
    BYTE fsState; 
    BYTE fsStyle; 
    DWORD dwData; 
    int iString; 
} TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON; 

Contains information about a button in a toolbar.

iBitmap
Zero-based index of the button image.
idCommand
Command identifier associated with the button. This identifier is used in a WM_COMMAND message when the button is chosen.
fsState
Button state flags. This member can be a combination of the values listed in Toolbar Button States.
fsStyle
Button style. This member can be a combination of the button style values listed in Toolbar Control and Button Styles.
dwData
Application-defined value.
iString
Zero-based index of the button string.

TBBUTTONINFO

typedef struct {
    UINT cbSize;
    DWORD dwMask;
    int idCommand;
    int iImage;
    BYTE fsState;
    BYTE fsStyle;
    WORD cx;
    DWORD lParam;
    LPTSTR pszText;
    int cchText;
} TBBUTTONINFOA, *LPTBBUTTONINFOA;

Contains or receives information for a specific button in a toolbar.

cbSize
Size of the structure, in bytes. This member must be filled in prior to sending the associated message.
dwMask
Set of flags that indicate which members contain valid information. This member must be filled in prior to sending the associated message. This can be one or more of the following values:
TBIF_COMMAND The idCommand member contains valid information or is being requested.
TBIF_IMAGE The iImage member contains valid information or is being requested.
TBIF_LPARAM The lParam member contains valid information or is being requested.
TBIF_SIZE The cx member contains valid information or is being requested.
TBIF_STATE The fsState member contains valid information or is being requested.
TBIF_STYLE The fsStyle member contains valid information or is being requested.
TBIF_TEXT The pszText member contains valid information or is being requested.
idCommand
Command identifier of the button.
iImage
Image index of the button. If this member is set to I_IMAGECALLBACK, the toolbar will send the TBN_GETDISPINFO notification to retrieve the image index when it is needed.
fsState
State flags of the button. This can be one or more of the toolbar button states.
fsStyle
Style flags of the button. This can be one or more of the toolbar button styles.
cx
Width of the button, in pixels.
lParam
Application-defined 32-bit value associated with the button.
pszText
Address of a character buffer that contains or receives the button text.
cchText
Size of the buffer at pszText. If the button information is being set, this member is ignored.

Version 4.71

TBINSERTMARK

typedef struct {
    int   iButton;
    DWORD dwFlags;
} TBINSERTMARK, * LPTBINSERTMARK;

Contains information on the insertion mark in a toolbar control.

iButton
Zero-based index of the insertion mark. If this member is -1, there is no insertion mark.
dwFlags
Defines where the insertion mark is in relation to iButton. This can be one of the following values:
0 The insertion mark is to the left of the specified button.
TBIMHT_AFTER The insertion mark is to the right of the specified button.
TBIMHT_BACKGROUND The insertion mark is on the background of the toolbar. This flag is only used with the TB_INSERTMARKHITTEST message.

TBREPLACEBITMAP

typedef struct {
    HINSTANCE hInstOld;
    UINT nIDOld;
    HINSTANCE hInstNew;
    UINT nIDNew;
    int nButtons;
} TBREPLACEBITMAP, *LPTBREPLACEBITMAP;

Used with the TB_REPLACEBITMAP message to replace one toolbar bitmap with another.

hInstOld
Module instance handle to the bitmap resource being replaced.
nIDOld
Resource identifier of the bitmap being replaced.
hInstNew
Module instance handle that contains the new bitmap resource.
nIDNew
Resource identifier of the new bitmap.
nButtons
Number of button images contained in the new bitmap.

TBSAVEPARAMS

typedef struct {
    HKEY hkr; 
    LPCTSTR pszSubKey; 
    LPCTSTR pszValueName; 
} TBSAVEPARAMS; 

Specifies the location in the registry where the TB_SAVERESTORE message stores and retrieves information about the state of a toolbar.

hkr
Handle to the registry key.
pszSubKey
Subkey name.
pszValueName
Value name.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.