using System; using System.Runtime.InteropServices; using static Vanara.PInvoke.User32; namespace Vanara.PInvoke { public static partial class ComCtl32 { /// Window class name for the Toolbar control. public const string TOOLBARCLASSNAME = "ToolbarWindow32"; /// public static readonly IntPtr HINST_COMMCTRL = new(-1); private const int TBN_FIRST = -700; /// Options for CreateMappedBitmap. public enum CMB { /// No flags CMB_NONE = 0, /// Uses a bitmap as a mask. CMB_MASKED = 2 } /// Flags that indicate why the hot item has changed in NMTBHOTITEM. [PInvokeData("Commctrl.h")] [Flags] public enum HICF : uint { /// The change in the hot item was caused by a shortcut key. HICF_ACCELERATOR = 0x00000004, /// The change in the hot item was caused by an arrow key. HICF_ARROWKEYS = 0x00000002, /// Modifies HICF_ACCELERATOR. If this flag is set, more than one item has the same shortcut key character. HICF_DUPACCEL = 0x00000008, /// /// Modifies the other reason flags. If this flag is set, there is no previous hot item and idOld does not contain valid information. /// HICF_ENTERING = 0x00000010, /// /// Modifies the other reason flags. If this flag is set, there is no new hot item and idNew does not contain valid information. /// HICF_LEAVING = 0x00000020, /// The change in the hot item resulted from a left-click mouse event. HICF_LMOUSE = 0x00000080, /// The change in the hot item resulted from a mouse event. HICF_MOUSE = 0x00000001, /// /// 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_OTHER = 0x00000000, /// The change in the hot item resulted from the user entering the shortcut key for an item that was already hot. HICF_RESELECT = 0x00000040, /// Version 5.80. Causes the button to switch states. HICF_TOGGLEDROPDOWN = 0x00000100, } /// Index values for IDB_HIST_LARGE_COLOR and IDB_HIST_SMALL_COLOR [PInvokeData("Commctrl.h")] public enum HIST { /// Move back. HIST_BACK = 0, /// Move forward. HIST_FORWARD = 1, /// Open favorites folder. HIST_FAVORITES = 2, /// Add to favorites. HIST_ADDTOFAVORITES = 3, /// View tree. HIST_VIEWTREE = 4, } /// Identifier of a system-defined button image list. Used by TB_LOADIMAGES. [PInvokeData("Commctrl.h")] public enum IDB { /// Standard bitmaps in small size. IDB_STD_SMALL_COLOR = 0, /// Standard bitmaps in large size. IDB_STD_LARGE_COLOR = 1, /// View bitmaps in small size. IDB_VIEW_SMALL_COLOR = 4, /// View bitmaps in large size. IDB_VIEW_LARGE_COLOR = 5, /// Windows Explorer bitmaps in small size. IDB_HIST_SMALL_COLOR = 8, /// Windows Explorer bitmaps in large size. IDB_HIST_LARGE_COLOR = 9, /// Windows Explorer travel buttons and favorites bitmaps in normal state. IDB_HIST_NORMAL = 12, /// Windows Explorer travel buttons and favorites bitmaps in hot state. IDB_HIST_HOT = 13, /// Windows Explorer travel buttons and favorites bitmaps in disabled state. IDB_HIST_DISABLED = 14, /// Windows Explorer travel buttons and favorites bitmaps in pressed state. IDB_HIST_PRESSED = 15, } /// Index values for IDB_STD_LARGE_COLOR and IDB_STD_SMALL_COLOR [PInvokeData("Commctrl.h")] public enum STD { /// Cut operation. STD_CUT = 0, /// Copy operation. STD_COPY = 1, /// Paste operation. STD_PASTE = 2, /// Undo operation. STD_UNDO = 3, /// Redo operation. STD_REDOW = 4, /// Delete operation. STD_DELETE = 5, /// New file operation. STD_FILENEW = 6, /// Open file operation. STD_FILEOPEN = 7, /// Save file operation. STD_FILESAVE = 8, /// Print preview operation. STD_PRINTPRE = 9, /// Properties operation. STD_PROPERTIES = 10, /// Help operation. STD_HELP = 11, /// Find operation. STD_FIND = 12, /// Replace operation. STD_REPLACE = 13, /// Print operation. STD_PRINT = 14, } /// /// The value your application can return depends on the current drawing stage. The dwDrawStage member of the associated /// NMCUSTOMDRAW structure holds a value that specifies the drawing stage. You must return one of the following values. /// [PInvokeData("Commctrl.h", MSDNShortId = "bb760492")] [Flags] public enum TBCDRF : uint { /// /// The control will draw itself. It will not send any additional NM_CUSTOMDRAW notification codes for this paint cycle. This /// occurs when dwDrawStage equals CDDS_PREPAINT. /// CDRF_DODEFAULT = 0x00000000, /// /// Your application specified a new font for the item; the control will use the new font. For more information on changing /// fonts, see Changing fonts and colors. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT. /// CDRF_NEWFONT = 0x00000002, /// /// Your application drew the item manually. The control will not draw the item. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT. /// CDRF_SKIPDEFAULT = 0x00000004, /// The control will notify the parent after painting an item. This occurs when dwDrawStage equals CDDS_PREPAINT. CDRF_NOTIFYPOSTPAINT = 0x00000010, /// /// The control will notify the parent of any item-related drawing operations. It will send NM_CUSTOMDRAW notification codes /// before and after drawing items. This occurs when dwDrawStage equals CDDS_PREPAINT. /// CDRF_NOTIFYITEMDRAW = 0x00000020, /// /// Version 4.71. The control will notify the parent when a list-view subitem is being drawn. This occurs when dwDrawStage equals CDDS_PREPAINT. /// CDRF_NOTIFYSUBITEMDRAW = 0x00000020, /// The control will notify the parent after erasing an item. This occurs when dwDrawStage equals CDDS_PREPAINT. CDRF_NOTIFYPOSTERASE = 0x00000040, /// Version 5.00. Blend the button 50 percent with the background. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT. TBCDRF_BLENDICON = 0x00200000, /// /// Version 4.71. Use the clrHighlightHotTrack member of the NMTBCUSTOMDRAW structure to draw the background of hot-tracked /// items. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT. /// TBCDRF_HILITEHOTTRACK = 0x00020000, /// Version 5.00. Do not draw button background. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT. TBCDRF_NOBACKGROUND = 0x00400000, /// Version 4.71. Do not draw button edges. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT. TBCDRF_NOEDGES = 0x00010000, /// Version 4.71. Do not draw etched effect for disabled items. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT. TBCDRF_NOETCHEDEFFECT = 0x00100000, /// Do not draw default highlight of items that have the TBSTATE_MARKED. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT. TBCDRF_NOMARK = 0x00080000, /// Version 4.71. Do not offset the button when pressed. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT. TBCDRF_NOOFFSET = 0x00040000, /// Version 6.00, Windows Vista only. Use custom draw colors to render text regardless of visual style. TBCDRF_USECDCOLORS = 0x00800000, } /// Return value from TBN_DROPDOWN. [PInvokeData("Commctrl.h")] public enum TBDDRET { /// The drop-down was handled. TBDDRET_DEFAULT = 0, /// The drop-down was not handled. TBDDRET_NODEFAULT = 1, /// The drop-down was handled, but treat the button like a regular button. TBDDRET_TREATPRESSED = 2, } /// Flags used by TBBUTTONINFO. [PInvokeData("Commctrl.h")] [Flags] public enum TBIF : uint { /// Version 5.80. The wParam sent with a TB_GETBUTTONINFO or TB_SETBUTTONINFO message is an index, not an identifier. TBIF_BYINDEX = 0x80000000, /// The idCommand member contains valid information or is being requested. TBIF_COMMAND = 0x00000020, /// The iImage member contains valid information or is being requested. TBIF_IMAGE = 0x00000001, /// The lParam member contains valid information or is being requested. TBIF_LPARAM = 0x00000010, /// The cx member contains valid information or is being requested. TBIF_SIZE = 0x00000040, /// The fsState member contains valid information or is being requested. TBIF_STATE = 0x00000004, /// The fsStyle member contains valid information or is being requested. TBIF_STYLE = 0x00000008, /// The pszText member contains valid information or is being requested. TBIF_TEXT = 0x00000002, } /// Defines where the insertion mark is in relation to iButton in TBINSERTMARK. [PInvokeData("Commctrl.h")] [Flags] public enum TBIMHT : uint { /// The insertion mark is to the right of the specified button. TBIMHT_AFTER = 0x00000001, /// /// The insertion mark is on the background of the toolbar. This flag is only used with the TB_INSERTMARKHITTEST message. /// TBIMHT_BACKGROUND = 0x00000002, } /// Mask that determines the metric to retrieve in TBMETRICS. [PInvokeData("Commctrl.h")] [Flags] public enum TBMF : uint { /// Retrieve the cxPad and cyPad values. TBMF_PAD = 0x00000001, /// Retrieve the cxBarPad and cyBarPad values. TBMF_BARPAD = 0x00000002, /// Retrieve the cxButtonSpacing and cyButtonSpacing values. TBMF_BUTTONSPACING = 0x00000004, } /// Set of flags that indicate which members of NMTBDISPINFO are being requested. [PInvokeData("Commctrl.h")] [Flags] public enum TBNF : uint { /// The item's image index is being requested. The image index must be placed in the iImage member. TBNF_IMAGE = 0x00000001, /// Not currently implemented. TBNF_TEXT = 0x00000002, /// /// Set this flag when processing TBN_GETDISPINFO; the toolbar control will retain the supplied information and not request it again. /// TBNF_DI_SETITEM = 0x10000000, } /// State values used by TB_GETSTATE and TB_SETSTATE. [PInvokeData("Commctrl.h")] [Flags] public enum TBSTATE : byte { /// The button has the TBSTYLE_CHECK style and is being clicked. TBSTATE_CHECKED = 0x01, /// Version 4.70. The button's text is cut off and an ellipsis is displayed. TBSTATE_ELLIPSES = 0x40, /// The button accepts user input. A button that does not have this state is grayed. TBSTATE_ENABLED = 0x04, /// The button is not visible and cannot receive user input. TBSTATE_HIDDEN = 0x08, /// The button is grayed. TBSTATE_INDETERMINATE = 0x10, /// Version 4.71. The button is marked. The interpretation of a marked item is dependent upon the application. TBSTATE_MARKED = 0x80, /// The button is being clicked. TBSTATE_PRESSED = 0x02, /// The button is followed by a line break. The button must also have the TBSTATE_ENABLED state. TBSTATE_WRAP = 0x20, } /// Toolbar Control Messages [PInvokeData("Commctrl.h")] public enum ToolbarMessage { /// /// Checks or unchecks a given button in a toolbar. /// Parameters /// wParam /// Command identifier of the button to check. /// lParam /// /// The LOWORD is a BOOL that indicates whether to check or uncheck the specified button. If TRUE, the check /// is added. If FALSE, the check is removed. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// When a button is checked, it is displayed in the pressed state. // https://docs.microsoft.com/en-us/windows/win32/controls/tb-checkbutton TB_CHECKBUTTON = WindowMessage.WM_USER + 2, /// /// Presses or releases the specified button in a toolbar. /// Parameters /// wParam /// Command identifier of the button to press or release. /// lParam /// /// The LOWORD is a BOOL that indicates whether to press or release the specified button. If TRUE, the /// button is pressed. If FALSE, the button is released. /// /// The HIWORD must be zero. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-pressbutton TB_PRESSBUTTON = WindowMessage.WM_USER + 3, /// /// Hides or shows the specified button in a toolbar. /// Parameters /// wParam /// Command identifier of the button to hide or show. /// lParam /// /// The LOWORD is a BOOL that indicates whether to hide or show the specified button. If TRUE, the button is /// hidden. If FALSE, the button is shown. /// /// The HIWORD must be zero. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-hidebutton TB_HIDEBUTTON = WindowMessage.WM_USER + 4, /// /// Sets or clears the indeterminate state of the specified button in a toolbar. /// Parameters /// wParam /// Command identifier of the button whose indeterminate state is to be set or cleared. /// lParam /// /// The LOWORD is a BOOL that indicates whether to set or clear the indeterminate state. If TRUE, the /// indeterminate state is set. If FALSE, the state is cleared. /// /// The HIWORD must be zero. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-indeterminate TB_INDETERMINATE = WindowMessage.WM_USER + 5, /// /// Sets the highlight state of a given button in a toolbar control. /// Parameters /// wParam /// Command identifier for a toolbar button. /// lParam /// /// The LOWORD is a BOOL that indicates the new highlight state. If TRUE, the button is highlighted. If /// FALSE, the button is set to its default state. /// /// The HIWORD must be zero. /// Returns /// Returns nonzero if successful, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-markbutton TB_MARKBUTTON = WindowMessage.WM_USER + 6, /// /// Determines whether the specified button in a toolbar is enabled. /// Parameters /// wParam /// Command identifier of the button. /// lParam /// Must be zero. /// Returns /// Returns nonzero if the button is enabled, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-isbuttonenabled TB_ISBUTTONENABLED = WindowMessage.WM_USER + 9, /// /// Determines whether the specified button in a toolbar is checked. /// Parameters /// wParam /// Command identifier of the button. /// lParam /// Must be zero. /// Returns /// Returns nonzero if the button is checked, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-isbuttonchecked TB_ISBUTTONCHECKED = WindowMessage.WM_USER + 10, /// /// Determines whether the specified button in a toolbar is pressed. /// Parameters /// wParam /// Command identifier of the button. /// lParam /// Must be zero. /// Returns /// Returns nonzero if the button is pressed, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-isbuttonpressed TB_ISBUTTONPRESSED = WindowMessage.WM_USER + 11, /// /// Determines whether the specified button in a toolbar is hidden. /// Parameters /// wParam /// Command identifier of the button. /// lParam /// Must be zero. /// Returns /// Returns nonzero if the button is hidden, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-isbuttonhidden TB_ISBUTTONHIDDEN = WindowMessage.WM_USER + 12, /// /// Determines whether the specified button in a toolbar is indeterminate. /// Parameters /// wParam /// Command identifier of the button. /// lParam /// Must be zero. /// Returns /// Returns nonzero if the button is indeterminate, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-isbuttonindeterminate TB_ISBUTTONINDETERMINATE = WindowMessage.WM_USER + 13, /// /// Checks the highlight state of a toolbar button. /// Parameters /// wParam /// Command identifier for a toolbar button. /// lParam /// Must be zero. /// Returns /// Returns nonzero if the button is highlighted, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-isbuttonhighlighted TB_ISBUTTONHIGHLIGHTED = WindowMessage.WM_USER + 14, /// /// Sets the state for the specified button in a toolbar. /// Parameters /// wParam /// Command identifier of the button. /// lParam /// The LOWORD is a combination of values listed in Toolbar Button States. The HIWORD must be zero. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setstate TB_SETSTATE = WindowMessage.WM_USER + 17, /// /// Retrieves information about the state of the specified button in a toolbar, such as whether it is enabled, pressed, or checked. /// Parameters /// wParam /// Command identifier of the button for which to retrieve information. /// lParam /// Must be zero. /// Returns /// /// Returns the button state information if successful, or -1 otherwise. The button state information can be a combination of the /// values listed in Toolbar Button States. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getstate TB_GETSTATE = WindowMessage.WM_USER + 18, /// /// Adds one or more images to the list of button images available for a toolbar. /// Parameters /// wParam /// Number of button images in the bitmap. If lParam specifies a system-defined bitmap, this parameter is ignored. /// lParam /// /// Pointer to a TBADDBITMAP structure that contains the identifier of a bitmap resource and the handle to the module /// instance with the executable file that contains the bitmap resource. /// /// Returns /// Returns the index of the first new image if successful, or -1 otherwise. /// /// /// If the toolbar was created using the CreateWindowEx function, you must send the TB_BUTTONSTRUCTSIZE message to /// the toolbar before sending TB_ADDBITMAP. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-addbitmap TB_ADDBITMAP = WindowMessage.WM_USER + 19, /// /// Adds one or more buttons to a toolbar. /// Parameters /// wParam /// Number of buttons to add. /// lParam /// /// Pointer to an array of TBBUTTON structures that contain information about the buttons to add. There must be the same /// number of elements in the array as buttons specified by wParam. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// /// If the toolbar was created using the CreateWindowEx function, you must send the TB_BUTTONSTRUCTSIZE message to /// the toolbar before sending TB_ADDBUTTONS. /// /// See TB_SETIMAGELIST for a discussion of how to assign bitmaps to toolbar buttons from one or more image lists. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-addbuttons TB_ADDBUTTONSA = WindowMessage.WM_USER + 20, /// /// Inserts a button in a toolbar. /// Parameters /// wParam /// Zero-based index of a button. The message inserts the new button to the left of this button. /// lParam /// Pointer to a TBBUTTON structure containing information about the button to insert. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-insertbutton TB_INSERTBUTTONA = WindowMessage.WM_USER + 21, /// /// Deletes a button from the toolbar. /// Parameters /// wParam /// Zero-based index of the button to delete. /// lParam /// Must be zero. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-deletebutton TB_DELETEBUTTON = WindowMessage.WM_USER + 22, /// /// Retrieves information about the specified button in a toolbar. /// Parameters /// wParam /// Zero-based index of the button for which to retrieve information. /// lParam /// Pointer to the TBBUTTON structure that receives the button information. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getbutton TB_GETBUTTON = WindowMessage.WM_USER + 23, /// /// Retrieves a count of the buttons currently in the toolbar. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the count of the buttons. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-buttoncount TB_BUTTONCOUNT = WindowMessage.WM_USER + 24, /// /// Retrieves the zero-based index for the button associated with the specified command identifier. /// Parameters /// wParam /// Command identifier associated with the button. /// lParam /// Must be zero. /// Returns /// Returns the zero-based index for the button or -1 if the specified command identifier is invalid. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-commandtoindex TB_COMMANDTOINDEX = WindowMessage.WM_USER + 25, /// /// Send this message to initiate saving or restoring a toolbar state. /// Parameters /// wParam /// /// Save or restore flag. If this parameter is TRUE, the information is saved. If it is FALSE, the information is restored. /// /// lParam /// /// Pointer to a TBSAVEPARAMS structure that specifies the registry key, subkey, and value name for the toolbar state information. /// /// Returns /// No return value. /// /// /// /// For version 4.72 and earlier, to use this message to save or restore a toolbar, the parent window of the toolbar control must /// implement a handler for the TBN_GETBUTTONINFO notification code. The toolbar issues this notification to retrieve information /// about each button as it is restored. /// /// /// Version 5.80 includes a new save/restore option. At the beginning of the process, and as each button is saved or restored, /// your application will receive a TBN_SAVE or TBN_RESTORE notification. To use this option, you must implement notification /// handlers to provide the Shell with the bitmap and state information it needs to successfully save or restore the toolbar state. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-saverestore TB_SAVERESTOREA = WindowMessage.WM_USER + 26, /// /// Send this message to initiate saving or restoring a toolbar state. /// Parameters /// wParam /// /// Save or restore flag. If this parameter is TRUE, the information is saved. If it is FALSE, the information is restored. /// /// lParam /// /// Pointer to a TBSAVEPARAMS structure that specifies the registry key, subkey, and value name for the toolbar state information. /// /// Returns /// No return value. /// /// /// /// For version 4.72 and earlier, to use this message to save or restore a toolbar, the parent window of the toolbar control must /// implement a handler for the TBN_GETBUTTONINFO notification code. The toolbar issues this notification to retrieve information /// about each button as it is restored. /// /// /// Version 5.80 includes a new save/restore option. At the beginning of the process, and as each button is saved or restored, /// your application will receive a TBN_SAVE or TBN_RESTORE notification. To use this option, you must implement notification /// handlers to provide the Shell with the bitmap and state information it needs to successfully save or restore the toolbar state. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-saverestore TB_SAVERESTOREW = WindowMessage.WM_USER + 76, /// /// Displays the Customize Toolbar dialog box. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// No return value. /// /// /// Note /// /// The toolbar must handle the TBN_QUERYINSERT and TBN_QUERYDELETE notifications for the Customize Toolbar dialog box to /// appear. If the toolbar does not handle those notifications, TB_CUSTOMIZE has no effect. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-customize TB_CUSTOMIZE = WindowMessage.WM_USER + 27, /// /// Adds a new string to the toolbar's string pool. /// Parameters /// wParam /// /// Handle to the module instance with an executable file that contains the string resource. If lParam instead points to a /// character array with one or more strings, set this parameter to NULL. /// /// lParam /// Resource identifier for the string resource, or a pointer to a TCHAR array. See Remarks. /// Returns /// Returns the index of the first new string if successful, or -1 otherwise. /// /// /// /// If wParam is NULL, lParam points to a character array with one or more null-terminated strings. The last string in the /// array must be terminated with two null characters. /// /// /// If wParam is the HINSTANCE of the application or of another module containing a string resource, lParam is the resource /// identifier of the string. Each item in the string must begin with an arbitrary separator character, and the string must end /// with two such characters. For example, the text for three buttons might appear in the string table as "/New/Open/Save//". The /// message returns the index of "New" in the toolbar's string pool, and the other items are in consecutive positions. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-addstring TB_ADDSTRINGA = WindowMessage.WM_USER + 28, /// /// Adds a new string to the toolbar's string pool. /// Parameters /// wParam /// /// Handle to the module instance with an executable file that contains the string resource. If lParam instead points to a /// character array with one or more strings, set this parameter to NULL. /// /// lParam /// Resource identifier for the string resource, or a pointer to a TCHAR array. See Remarks. /// Returns /// Returns the index of the first new string if successful, or -1 otherwise. /// /// /// /// If wParam is NULL, lParam points to a character array with one or more null-terminated strings. The last string in the /// array must be terminated with two null characters. /// /// /// If wParam is the HINSTANCE of the application or of another module containing a string resource, lParam is the resource /// identifier of the string. Each item in the string must begin with an arbitrary separator character, and the string must end /// with two such characters. For example, the text for three buttons might appear in the string table as "/New/Open/Save//". The /// message returns the index of "New" in the toolbar's string pool, and the other items are in consecutive positions. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-addstring TB_ADDSTRINGW = WindowMessage.WM_USER + 77, /// /// Retrieves the bounding rectangle of a button in a toolbar. /// Parameters /// wParam /// Zero-based index of the button for which to retrieve information. /// lParam /// Pointer to a RECT structure that receives the client coordinates of the bounding rectangle. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// This message does not retrieve the bounding rectangle for buttons whose state is set to the TBSTATE_HIDDEN value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getitemrect TB_GETITEMRECT = WindowMessage.WM_USER + 29, /// /// Specifies the size of the TBBUTTON structure. /// Parameters /// wParam /// Size, in bytes, of the TBBUTTON structure. /// lParam /// Must be zero. /// Returns /// No return value. /// /// /// The system uses the size to determine which version of the common control dynamic-link library (DLL) is being used. /// /// If an application uses the CreateWindowEx function to create the toolbar, the application must send this message to /// the toolbar before sending the TB_ADDBITMAP or TB_ADDBUTTONS message. The CreateToolbarEx function /// automatically sends TB_BUTTONSTRUCTSIZE, and the size of the TBBUTTON structure is a parameter of the function. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-buttonstructsize TB_BUTTONSTRUCTSIZE = WindowMessage.WM_USER + 30, /// /// Sets the size of buttons on a toolbar. /// Parameters /// wParam /// Must be zero. /// lParam /// /// The LOWORD specifies the width, in pixels, of the buttons. The HIWORD specifies the height, in pixels, of the buttons. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// TB_SETBUTTONSIZE should generally be called after adding buttons. /// /// Use TB_SETBUTTONWIDTH to set the maximum and minimum allowed widths for buttons before they are added. Use /// TB_SETBUTTONSIZE to set the actual size of buttons. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setbuttonsize TB_SETBUTTONSIZE = WindowMessage.WM_USER + 31, /// /// Sets the size of the bitmapped images to be added to a toolbar. /// Parameters /// wParam /// Must be zero. /// lParam /// /// The LOWORD specifies the width, in pixels, of the bitmapped images. The HIWORD specifies the height, in pixels, /// of the bitmapped images. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// The size can be set only before adding any bitmaps to the toolbar. If an application does not explicitly set the bitmap size, /// the size defaults to 16 by 15 pixels. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setbitmapsize TB_SETBITMAPSIZE = WindowMessage.WM_USER + 32, /// /// Causes a toolbar to be resized. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// No return value. /// /// /// An application sends the TB_AUTOSIZE message after causing the size of a toolbar to change either by setting the /// button or bitmap size or by adding strings for the first time. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-autosize TB_AUTOSIZE = WindowMessage.WM_USER + 33, /// /// Retrieves the handle to the tooltip control, if any, associated with the toolbar. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the handle to the tooltip control, or NULL if the toolbar has no associated tooltip. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-gettooltips TB_GETTOOLTIPS = WindowMessage.WM_USER + 35, /// /// Associates a tooltip control with a toolbar. /// Parameters /// wParam /// Handle to the tooltip control. /// lParam /// Must be zero. /// Returns /// No return value. /// /// /// Any buttons added to a toolbar before sending the TB_SETTOOLTIPS message will not be registered with the tooltip control. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-settooltips TB_SETTOOLTIPS = WindowMessage.WM_USER + 36, /// /// Sets the window to which the toolbar control sends notification messages. /// Parameters /// wParam /// Handle to the window to receive notification messages. /// lParam /// Must be zero. /// Returns /// /// The return value is a handle to the previous notification window, or NULL if there is no previous notification window. /// /// /// /// The TB_SETPARENT message does not change the parent window that was specified when the control was created. Calling /// the GetParent function for a toolbar control will return the actual parent window, not the window specified in /// TB_SETPARENT. To change the control's parent window, call the SetParent function. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setparent TB_SETPARENT = WindowMessage.WM_USER + 37, /// /// Sets the number of rows of buttons in a toolbar. /// Parameters /// wParam /// /// The LOWORD specifies the number of rows requested. The minimum number of rows is one, and the maximum number of rows /// is equal to the number of buttons in the toolbar. /// /// /// The HIWORD is a BOOL that indicates whether to create more rows than requested when the system cannot create /// the number of rows specified by wParam. If TRUE, the system creates more rows. If FALSE, the system creates /// fewer rows. /// /// lParam /// Pointer to a RECT structure that receives the bounding rectangle of the toolbar after the rows are set. /// Returns /// No return value. /// /// /// Because the system does not break up button groups when setting the number of rows, the resulting number of rows might differ /// from the number requested. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setrows TB_SETROWS = WindowMessage.WM_USER + 39, /// /// Retrieves the number of rows of buttons in a toolbar with the TBSTYLE_WRAPABLE style. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the number of rows. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getrows TB_GETROWS = WindowMessage.WM_USER + 40, /// /// Retrieves the flags that describe the type of bitmap to be used. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// /// Returns a DWORD value that describes the type of bitmap that should be used. If this return value has the TBBF_LARGE /// flag set, applications should use large bitmaps (24 x 24); otherwise, applications should use small bitmaps (16 x 16). All /// other bits are reserved. /// /// /// /// The value returned by TB_GETBITMAPFLAGS is only advisory. The toolbar control recommends large or small bitmaps based /// upon whether the user has chosen large or small fonts. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getbitmapflags TB_GETBITMAPFLAGS = WindowMessage.WM_USER + 41, /// /// Sets the command identifier of a toolbar button. /// Parameters /// wParam /// Zero-based index of the button whose command identifier is to be set. /// lParam /// Command identifier. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setcmdid TB_SETCMDID = WindowMessage.WM_USER + 42, /// /// Changes the bitmap for a button in a toolbar. /// Parameters /// wParam /// Command identifier of the button that is to receive a new bitmap. /// lParam /// /// Zero-based index of an image in the toolbar's image list. The system displays the specified image in the button. Set this /// parameter to I_IMAGECALLBACK, and the toolbar will send the TBN_GETDISPINFO notification to retrieve the image index /// when it is needed. /// /// /// Version 5.81. Set this parameter to I_IMAGENONE to indicate that the button does not have an image. The button layout will /// not include any space for a bitmap, only text. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-changebitmap TB_CHANGEBITMAP = WindowMessage.WM_USER + 43, /// /// Retrieves the index of the bitmap associated with a button in a toolbar. /// Parameters /// wParam /// Command identifier of the button whose bitmap index is to be retrieved. /// lParam /// Must be zero. /// Returns /// Returns the index of the bitmap if successful, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getbitmap TB_GETBITMAP = WindowMessage.WM_USER + 44, /// /// Retrieves the display text of a button on a toolbar. /// Parameters /// wParam /// Command identifier of the button whose text is to be retrieved. /// lParam /// Pointer to a buffer that receives the button text. /// Returns /// /// Returns the length, in characters, of the string pointed to by lParam. The length does not include the terminating null /// character. If unsuccessful, the return value is -1. /// /// /// /// /// Security Warning: Using this message incorrectly might compromise the security of your program. This message does not /// provide a way for you to know the size of the buffer. If you use this message, first call the message passing NULL in /// the lParam, this returns the number of characters, excluding NULL that are required. Then call the message a second /// time to retrieve the string. You should review the Security Considerations: Microsoft Windows Controls before continuing. /// /// The returned string corresponds to the text that is currently displayed by the button. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getbuttontext TB_GETBUTTONTEXTA = WindowMessage.WM_USER + 45, /// /// Retrieves the display text of a button on a toolbar. /// Parameters /// wParam /// Command identifier of the button whose text is to be retrieved. /// lParam /// Pointer to a buffer that receives the button text. /// Returns /// /// Returns the length, in characters, of the string pointed to by lParam. The length does not include the terminating null /// character. If unsuccessful, the return value is -1. /// /// /// /// /// Security Warning: Using this message incorrectly might compromise the security of your program. This message does not /// provide a way for you to know the size of the buffer. If you use this message, first call the message passing NULL in /// the lParam, this returns the number of characters, excluding NULL that are required. Then call the message a second /// time to retrieve the string. You should review the Security Considerations: Microsoft Windows Controls before continuing. /// /// The returned string corresponds to the text that is currently displayed by the button. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getbuttontext TB_GETBUTTONTEXTW = WindowMessage.WM_USER + 75, /// /// Replaces an existing bitmap with a new bitmap. /// Parameters /// wParam /// Must be zero. /// lParam /// /// Pointer to a TBREPLACEBITMAP structure that contains the information of the bitmap to be replaced and the new bitmap. /// /// Returns /// Returns nonzero if successful, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-replacebitmap TB_REPLACEBITMAP = WindowMessage.WM_USER + 46, /// /// Sets the indentation for the first button in a toolbar control. /// Parameters /// wParam /// Value specifying the indentation, in pixels. /// lParam /// Must be zero. /// Returns /// Returns nonzero if successful, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setindent TB_SETINDENT = WindowMessage.WM_USER + 47, /// /// Sets the image list that the toolbar uses to display buttons that are in their default state. /// Parameters /// wParam /// /// Version 5.80. The index of the list. If you use only one image list, or an earlier version of the common controls, set wParam /// to zero. See Remarks for details on using multiple image lists. /// /// lParam /// Handle to the image list to set. If this parameter is NULL, no images are displayed in the buttons. /// Returns /// /// Returns the handle to the image list previously used to display buttons in their default state, or NULL if no image /// list was previously set. /// /// /// /// /// Note /// Your application is responsible for freeing the image list after the toolbar is destroyed. /// /// /// The TB_SETIMAGELIST message cannot be combined with TB_ADDBITMAP. It also cannot be used with toolbars created /// with CreateToolbarEx, which calls TB_ADDBITMAP internally. When you create a toolbar with /// CreateToolbarEx or use TB_ADDBITMAP to add images, the toolbar manages the image list internally. Attempting to /// modify it with TB_SETIMAGELIST has unpredictable consequences. /// /// /// With version 5.80 or later of the common controls, button images need not come from the same image list. To use multiple /// image lists for your toolbar button images: /// /// /// /// /// Enable multiple image lists by sending the toolbar control a CCM_SETVERSION message with wParam (the version number) /// set to 5. /// /// /// /// /// For each image list you want to use, send the toolbar control a TB_SETIMAGELIST message. Set wParam to an /// application-defined wParam value that will be used to identify the list. Set lParam to the list's HIMAGELIST handle. /// /// /// /// /// For each button, set the iBitmap member of the button's TBBUTTON structure to MAKELONG(iIndex, iImageID). The /// iImageID value is the ID of the appropriate image list that was defined in step two. The iIndex value is the index of the /// particular image within that list. /// /// /// /// Add the buttons by sending the toolbar control a TB_ADDBUTTONS message. /// /// /// /// The following code fragment illustrates how to add five buttons to a toolbar, with images from three different image lists. /// Support for multiple image lists is enabled with a CCM_SETVERSION message. The image lists are then set and assigned /// IDs of 0-2. The buttons are assigned images from the image lists as follows: /// /// /// /// Button 0 is from image list zero (ahim[0]) with index of 1. /// /// /// Button 1 is from image list one (ahim[1]) with an index of 1. /// /// /// Button 2 is from image list two (ahim[2]) with an index of 1. /// /// /// Button 3 is from image list zero (ahim[0]) with an index of 2. /// /// /// Button 4 is from image list one (ahim[1]) with an index of 3. /// /// /// Finally, the buttons are added to the toolbar control with a TB_ADDBUTTONS message. /// /// //Enable multiple image lists SendMessage(hwndTB, CCM_SETVERSION, (WPARAM) 5, 0); //Set the image lists and assign them IDs of 0-2 SendMessage(hwndTB, TB_SETIMAGELIST, 0, (LPARAM)ahiml[0]); SendMessage(hwndTB, TB_SETIMAGELIST, 1, (LPARAM)ahiml[1]); SendMessage(hwndTB, TB_SETIMAGELIST, 2, (LPARAM)ahiml[2]); // Create the five buttons TBBUTTON rgtb[5]; //... initialize the TBBUTTON structures as usual ... //Assign images to each button rgtb[0].iBitmap = MAKELONG(1, 0); rgtb[1].iBitmap = MAKELONG(1, 1); rgtb[2].iBitmap = MAKELONG(1, 2); rgtb[3].iBitmap = MAKELONG(2, 0); rgtb[4].iBitmap = MAKELONG(3, 1); // Add the five buttons to the toolbar control SendMessage(hwndTB, TB_ADDBUTTONS, 5, (LPARAM)(&rgtb); /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setimagelist TB_SETIMAGELIST = WindowMessage.WM_USER + 48, /// /// 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. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the handle to the image list, or NULL if no image list is set. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getimagelist TB_GETIMAGELIST = WindowMessage.WM_USER + 49, /// /// Loads system-defined button images into a toolbar control's image list. /// Parameters /// wParam /// Identifier of a system-defined button image list. This parameter can be set to one of the following values. /// /// /// Value /// Meaning /// /// /// IDB_HIST_LARGE_COLOR /// Windows Explorer bitmaps in large size. /// /// /// IDB_HIST_SMALL_COLOR /// Windows Explorer bitmaps in small size. /// /// /// IDB_STD_LARGE_COLOR /// Standard bitmaps in large size. /// /// /// IDB_STD_SMALL_COLOR /// Standard bitmaps in small size. /// /// /// IDB_VIEW_LARGE_COLOR /// View bitmaps in large size. /// /// /// IDB_VIEW_SMALL_COLOR /// View bitmaps in small size. /// /// /// IDB_HIST_NORMAL /// Windows Explorer travel buttons and favorites bitmaps in normal state. /// /// /// IDB_HIST_HOT /// Windows Explorer travel buttons and favorites bitmaps in hot state. /// /// /// IDB_HIST_DISABLED /// Windows Explorer travel buttons and favorites bitmaps in disabled state. /// /// /// IDB_HIST_PRESSED /// Windows Explorer travel buttons and favorites bitmaps in pressed state. /// /// /// lParam /// Instance handle. This parameter must be set to HINST_COMMCTRL. /// Returns /// /// The count of images in the image list. Returns zero if the toolbar has no image list or if the existing image list is empty. /// /// /// /// You must use the proper image index values when you prepare TBBUTTON structures prior to sending the /// TB_ADDBUTTONS message. For a list of image index values for these preset bitmaps, see Toolbar Standard Button Image /// Index Values. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-loadimages TB_LOADIMAGES = WindowMessage.WM_USER + 50, /// /// Retrieves the bounding rectangle for a specified toolbar button. /// Parameters /// wParam /// Command identifier of the button. /// lParam /// Pointer to a RECT structure that will receive the bounding rectangle information. /// Returns /// Returns nonzero if successful, or zero otherwise. /// /// /// This message does not retrieve the bounding rectangle for buttons whose state is set to the TBSTATE_HIDDEN value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getrect TB_GETRECT = WindowMessage.WM_USER + 51, /// /// Sets the image list that the toolbar control will use to display hot buttons. /// Parameters /// wParam /// Must be zero. /// lParam /// Handle to the image list that will be set. /// Returns /// /// Returns the handle to the image list previously used to display hot buttons, or NULL if no image list was previously set. /// /// /// /// A button is hot when the cursor is over it. Toolbar controls must have the TBSTYLE_FLAT or TBSTYLE_LIST style /// to have hot items. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-sethotimagelist TB_SETHOTIMAGELIST = WindowMessage.WM_USER + 52, /// /// Retrieves the image list that a toolbar control uses to display hot buttons. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// /// Returns the handle to the image list that the control uses to display hot buttons, or NULL if no hot image list is set. /// /// /// /// A button is hot when the cursor is over it. Toolbar controls must have the TBSTYLE_FLAT or TBSTYLE_LIST style /// to have hot items. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-gethotimagelist TB_GETHOTIMAGELIST = WindowMessage.WM_USER + 53, /// /// Sets the image list that the toolbar control will use to display disabled buttons. /// Parameters /// wParam /// Must be zero. /// lParam /// Handle to the image list that will be set. /// Returns /// /// Returns the handle to the image list previously used to display disabled buttons, or NULL if no image list was /// previously set. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setdisabledimagelist TB_SETDISABLEDIMAGELIST = WindowMessage.WM_USER + 54, /// /// Retrieves the image list that a toolbar control uses to display inactive buttons. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the handle to the inactive image list, or NULL if no inactive image list is set. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getdisabledimagelist TB_GETDISABLEDIMAGELIST = WindowMessage.WM_USER + 55, /// /// Sets the style for a toolbar control. /// Parameters /// wParam /// Must be zero. /// lParam /// Value specifying the styles to be set for the control. This value can be a combination of toolbar control styles. /// Returns /// No return value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setstyle TB_SETSTYLE = WindowMessage.WM_USER + 56, /// /// Retrieves the styles currently in use for a toolbar control. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns a DWORD value that is a combination of toolbar control styles. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getstyle TB_GETSTYLE = WindowMessage.WM_USER + 57, /// /// Retrieves the current width and height of toolbar buttons, in pixels. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns a DWORD value that contains the width and height values in the low word and high word, respectively. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getbuttonsize TB_GETBUTTONSIZE = WindowMessage.WM_USER + 58, /// /// Sets the minimum and maximum button widths in the toolbar control. /// Parameters /// wParam /// Must be zero. /// lParam /// The LOWORD specifies the minimum button width, in pixels. Toolbar buttons will never be narrower than this value. /// /// The HIWORD specifies the maximum button width, in pixels. If button text is too wide, the control displays it with /// ellipsis points. /// /// Returns /// Returns nonzero if successful, or zero otherwise. /// /// /// Use TB_SETBUTTONWIDTH to set the maximum and minimum allowed widths for buttons before they are added. Use /// TB_SETBUTTONSIZE to set the actual size of buttons. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setbuttonwidth TB_SETBUTTONWIDTH = WindowMessage.WM_USER + 59, /// /// Sets the maximum number of text rows displayed on a toolbar button. /// Parameters /// wParam /// Maximum number of rows of text that can be displayed. /// lParam /// Must be zero. /// Returns /// Returns nonzero if successful, or zero otherwise. /// /// /// To cause text to wrap, you must set the maximum button width by sending a TB_SETBUTTONWIDTH message. The text wraps at /// a word break; line breaks ("\n") in the text are ignored. Text in TBSTYLE_LIST toolbars is always shown on a single line. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setmaxtextrows TB_SETMAXTEXTROWS = WindowMessage.WM_USER + 60, /// /// Retrieves the maximum number of text rows that can be displayed on a toolbar button. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns an INT value representing the maximum number of text rows that the control will display for a button. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-gettextrows TB_GETTEXTROWS = WindowMessage.WM_USER + 61, /// /// Retrieves the IDropTarget for a toolbar control. /// Parameters /// wParam /// Identifier of the interface being requested. This value must point to IID_IDropTarget. /// lParam /// Address that receives the interface pointer. If an error occurs, a NULL pointer is placed in this address. /// Returns /// Returns an HRESULT value indicating success or failure of the operation. /// /// The toolbar's IDropTarget is used by the toolbar when objects are dragged over or dropped onto it. // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getobject TB_GETOBJECT = WindowMessage.WM_USER + 62, /// /// Retrieves extended information for a button in a toolbar. /// Parameters /// wParam /// Command identifier of the button. /// lParam /// /// Pointer to a TBBUTTONINFO structure that receives the button information. The cbSize and dwMask members /// of this structure must be filled in prior to sending this message. /// /// Returns /// Returns the zero-based index of the button, or -1 if an error occurs. /// /// /// When you use TB_ADDBUTTONS or TB_INSERTBUTTON to place buttons on the toolbar, the button text is commonly /// specified by its string pool index. TB_GETBUTTONINFO will not retrieve this string. To use TB_GETBUTTONINFO to /// retrieve button text, you must first set the text string with TB_SETBUTTONINFO. Once you have set the button text with /// TB_SETBUTTONINFO, you can no longer use the string pool index. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getbuttoninfo TB_GETBUTTONINFOW = WindowMessage.WM_USER + 63, /// /// Sets the information for an existing button in a toolbar. /// Parameters /// wParam /// Button identifier. /// lParam /// /// Pointer to a TBBUTTONINFO structure that contains the new button information. The cbSize and dwMask /// members of this structure must be filled in prior to sending this message. /// /// Returns /// Returns nonzero if successful, or zero otherwise. /// /// /// Text is commonly assigned to buttons when they are added to a toolbar by specifying the index of a string in the toolbar's /// string pool. If you use a TB_SETBUTTONINFO to assign new text to a button, it will permanently override the text from /// the string pool. You can change the text by calling TB_SETBUTTONINFO again, but you cannot reassign the string from /// the string pool. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setbuttoninfo TB_SETBUTTONINFOW = WindowMessage.WM_USER + 64, /// /// Retrieves extended information for a button in a toolbar. /// Parameters /// wParam /// Command identifier of the button. /// lParam /// /// Pointer to a TBBUTTONINFO structure that receives the button information. The cbSize and dwMask members /// of this structure must be filled in prior to sending this message. /// /// Returns /// Returns the zero-based index of the button, or -1 if an error occurs. /// /// /// When you use TB_ADDBUTTONS or TB_INSERTBUTTON to place buttons on the toolbar, the button text is commonly /// specified by its string pool index. TB_GETBUTTONINFO will not retrieve this string. To use TB_GETBUTTONINFO to /// retrieve button text, you must first set the text string with TB_SETBUTTONINFO. Once you have set the button text with /// TB_SETBUTTONINFO, you can no longer use the string pool index. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getbuttoninfo TB_GETBUTTONINFOA = WindowMessage.WM_USER + 65, /// /// Sets the information for an existing button in a toolbar. /// Parameters /// wParam /// Button identifier. /// lParam /// /// Pointer to a TBBUTTONINFO structure that contains the new button information. The cbSize and dwMask /// members of this structure must be filled in prior to sending this message. /// /// Returns /// Returns nonzero if successful, or zero otherwise. /// /// /// Text is commonly assigned to buttons when they are added to a toolbar by specifying the index of a string in the toolbar's /// string pool. If you use a TB_SETBUTTONINFO to assign new text to a button, it will permanently override the text from /// the string pool. You can change the text by calling TB_SETBUTTONINFO again, but you cannot reassign the string from /// the string pool. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setbuttoninfo TB_SETBUTTONINFOA = WindowMessage.WM_USER + 66, /// /// Inserts a button in a toolbar. /// Parameters /// wParam /// Zero-based index of a button. The message inserts the new button to the left of this button. /// lParam /// Pointer to a TBBUTTON structure containing information about the button to insert. /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-insertbutton TB_INSERTBUTTONW = WindowMessage.WM_USER + 67, /// /// Adds one or more buttons to a toolbar. /// Parameters /// wParam /// Number of buttons to add. /// lParam /// /// Pointer to an array of TBBUTTON structures that contain information about the buttons to add. There must be the same /// number of elements in the array as buttons specified by wParam. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// /// /// /// If the toolbar was created using the CreateWindowEx function, you must send the TB_BUTTONSTRUCTSIZE message to /// the toolbar before sending TB_ADDBUTTONS. /// /// See TB_SETIMAGELIST for a discussion of how to assign bitmaps to toolbar buttons from one or more image lists. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-addbuttons TB_ADDBUTTONSW = WindowMessage.WM_USER + 68, /// /// Determines where a point lies in a toolbar control. /// Parameters /// wParam /// Must be zero. /// lParam /// /// Pointer to a POINT structure that contains the x-coordinate of the hit test in the x member and the /// y-coordinate of the hit test in the y member. The coordinates are relative to the toolbar's client area. /// /// Returns /// /// Returns an integer value. If the return value is zero or a positive value, it is the zero-based index of the nonseparator /// item in which the point lies. If the return value is negative, the point does not lie within a button. The absolute value of /// the return value is the index of a separator item or the nearest nonseparator item. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-hittest TB_HITTEST = WindowMessage.WM_USER + 69, /// /// Sets the text drawing flags for the toolbar. /// Parameters /// wParam /// /// One or more of the DT_ flags, specified in DrawText, that indicate which bits in lParam will be used when drawing the text. /// /// lParam /// /// One or more of the DT_ flags, specified in DrawText, that indicate how the button text will be drawn. This value will /// be passed to the DrawText function when the button text is drawn. /// /// Returns /// Returns the previous text drawing flags. /// /// /// The wParam parameter allows you to specify which flags will be used when drawing the text, even if these flags are turned /// off. For example, if you do not want the DT_CENTER flag used when drawing text, you would add the DT_CENTER flag to wParam /// and not specify the DT_CENTER flag in lParam. This prevents the control from passing the DT_CENTER flag to the /// DrawText function. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setdrawtextflags TB_SETDRAWTEXTFLAGS = WindowMessage.WM_USER + 70, /// /// Retrieves the index of the hot item in a toolbar. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// /// Returns the index of the hot item, or -1 if no hot item is set. Toolbar controls that do not have the TBSTYLE_FLAT /// style do not have hot items. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-gethotitem TB_GETHOTITEM = WindowMessage.WM_USER + 71, /// /// Sets the hot item in a toolbar. /// Parameters /// wParam /// Index of the item that will be made hot. If this value is -1, none of the items will be hot. /// lParam /// Must be zero. /// Returns /// Returns the index of the previous hot item, or -1 if there was no hot item. /// /// The behavior of this message is not defined for toolbars that do not have the TBSTYLE_FLAT style. // https://docs.microsoft.com/en-us/windows/win32/controls/tb-sethotitem TB_SETHOTITEM = WindowMessage.WM_USER + 72, /// /// Sets the anchor highlight setting for a toolbar. /// Parameters /// wParam /// /// BOOL value that specifies if anchor highlighting is enabled or disabled. If this value is nonzero, anchor highlighting /// will be enabled. If this value is zero, anchor highlighting will be disabled. /// /// lParam /// Must be zero. /// Returns /// /// Returns the previous anchor highlight setting. If this value is nonzero, anchor highlighting was enabled. If this value is /// zero, anchor highlighting was disabled. /// /// /// /// Anchor highlighting in a toolbar means that the last highlighted item will remain highlighted until another item is /// highlighted. This occurs even if the cursor leaves the toolbar control. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setanchorhighlight TB_SETANCHORHIGHLIGHT = WindowMessage.WM_USER + 73, /// /// Retrieves the anchor highlight setting for a toolbar. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// /// Returns a Boolean value that indicates if anchor highlighting is set. If this value is nonzero, anchor highlighting is /// enabled. If this value is zero, it is disabled. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getanchorhighlight TB_GETANCHORHIGHLIGHT = WindowMessage.WM_USER + 74, /// /// Determines the ID of the button that corresponds to the specified accelerator character. /// Parameters /// wParam /// The accelerator character. /// lParam /// /// Pointer to a UINT. On return, if successful, this parameter will hold the id of the button that has wParam as its /// accelerator character. /// /// Returns /// Returns a nonzero value if one of the buttons has wParam as its accelerator character, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-mapaccelerator TB_MAPACCELERATORA = WindowMessage.WM_USER + 78, /// /// Retrieves the current insertion mark for the toolbar. /// Parameters /// wParam /// Must be zero. /// lParam /// Pointer to a TBINSERTMARK structure that receives the insertion mark. /// Returns /// Always returns TRUE. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getinsertmark TB_GETINSERTMARK = WindowMessage.WM_USER + 79, /// /// Sets the current insertion mark for the toolbar. /// Parameters /// wParam /// Must be zero. /// lParam /// Pointer to a TBINSERTMARK structure that contains the insertion mark. /// Returns /// The return value for this message is not used. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setinsertmark TB_SETINSERTMARK = WindowMessage.WM_USER + 80, /// /// Retrieves the insertion mark information for a point in a toolbar. /// Parameters /// wParam /// Pointer to a POINT structure that contains the hit test coordinates, relative to the client area of the toolbar. /// lParam /// Pointer to a TBINSERTMARK structure that receives the insertion mark information. /// Returns /// Returns nonzero if the point is an insertion mark, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-insertmarkhittest TB_INSERTMARKHITTEST = WindowMessage.WM_USER + 81, /// /// Moves a button from one index to another. /// Parameters /// wParam /// Zero-based index of the button to be moved. /// lParam /// Zero-based index where the button will be moved. /// Returns /// Returns nonzero if successful, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-movebutton TB_MOVEBUTTON = WindowMessage.WM_USER + 82, /// /// Retrieves the total size of all of the visible buttons and separators in the toolbar. /// Parameters /// wParam /// Must be zero. /// lParam /// Pointer to a SIZE structure that receives the size of the items. /// Returns /// Returns nonzero if successful, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getmaxsize TB_GETMAXSIZE = WindowMessage.WM_USER + 83, /// /// Sets the extended styles for a toolbar control. /// Parameters /// wParam /// Must be zero. /// lParam /// Value specifying the new extended styles. This parameter can be a combination of extended styles. /// Returns /// Returns a DWORD that represents the previous extended styles. This value can be a combination of extended styles. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setextendedstyle TB_SETEXTENDEDSTYLE = WindowMessage.WM_USER + 84, /// /// Retrieves the extended styles for a toolbar control. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// /// Returns a DWORD that represents the styles currently in use for the toolbar control. This value can be a combination /// of extended styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getextendedstyle TB_GETEXTENDEDSTYLE = WindowMessage.WM_USER + 85, /// /// Retrieves the padding for a toolbar control. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// /// Returns a DWORD value that contains the horizontal padding in the low word and the vertical padding in the high word, /// in pixels. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getpadding TB_GETPADDING = WindowMessage.WM_USER + 86, /// /// Sets the padding for a toolbar control. /// Parameters /// wParam /// Must be zero. /// lParam /// /// The LOWORD specifies the horizontal padding, in pixels. The HIWORD specifies the vertical padding, in pixels. /// /// Returns /// /// Returns a DWORD value that contains the previous horizontal padding in the LOWORD and the previous vertical /// padding in the HIWORD, in pixels. /// /// /// /// The padding values are used to create a blank area between the edge of the button and the button's image and/or text. Where /// and how much padding is actually applied depends on the type of the button and whether it has an image. The horizontal /// padding is applied to both the right and left of the button, and the vertical padding is applied to both the top and bottom /// of the button. Padding is only applied to buttons that have the TBSTYLE_AUTOSIZE style. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setpadding TB_SETPADDING = WindowMessage.WM_USER + 87, /// /// Sets the color used to draw the insertion mark for the toolbar. /// Parameters /// wParam /// Must be zero. /// lParam /// COLORREF value that contains the new insertion mark color. /// Returns /// Returns a COLORREF value that contains the previous insertion mark color. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setinsertmarkcolor TB_SETINSERTMARKCOLOR = WindowMessage.WM_USER + 88, /// /// Retrieves the color used to draw the insertion mark for the toolbar. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns a COLORREF value that contains the current insertion mark color. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getinsertmarkcolor TB_GETINSERTMARKCOLOR = WindowMessage.WM_USER + 89, /// /// Determines the ID of the button that corresponds to the specified accelerator character. /// Parameters /// wParam /// The accelerator character. /// lParam /// /// Pointer to a UINT. On return, if successful, this parameter will hold the id of the button that has wParam as its /// accelerator character. /// /// Returns /// Returns a nonzero value if one of the buttons has wParam as its accelerator character, or zero otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-mapaccelerator TB_MAPACCELERATORW = WindowMessage.WM_USER + 90, /// /// Retrieves a string from a toolbar's string pool. /// Parameters /// wParam /// /// The LOWORD specifies the length of the lParam buffer, in bytes. The HIWORD specifies the index of the string. /// /// lParam /// Pointer to a buffer used to return the string. /// Returns /// Returns the string length if successful, or -1 otherwise. /// /// /// This message returns the specified string from the toolbar's string pool. It does not necessarily correspond to the text /// string currently being displayed by a button. To retrieve a button's current text string, send the toolbar a /// TB_GETBUTTONTEXT message. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getstring TB_GETSTRINGW = WindowMessage.WM_USER + 91, /// /// Retrieves a string from a toolbar's string pool. /// Parameters /// wParam /// /// The LOWORD specifies the length of the lParam buffer, in bytes. The HIWORD specifies the index of the string. /// /// lParam /// Pointer to a buffer used to return the string. /// Returns /// Returns the string length if successful, or -1 otherwise. /// /// /// This message returns the specified string from the toolbar's string pool. It does not necessarily correspond to the text /// string currently being displayed by a button. To retrieve a button's current text string, send the toolbar a /// TB_GETBUTTONTEXT message. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getstring TB_GETSTRINGA = WindowMessage.WM_USER + 92, /// /// /// [Intended for internal use; not recommended for use in applications. This message may not be supported in future versions of Windows.] /// /// Sets the bounding size for a multi-column toolbar control. /// Parameters /// wParam /// Must be zero. /// lParam /// /// Pointer to a SIZE structure whose cy member contains the bounding height. The cx member (the width) is ignored. /// /// Returns /// The return value is not used. /// /// /// The bounding size controls how buttons are organized into columns. If the toolbar control does not have the /// TBSTYLE_EX_MULTICOLUMN style, this message has no effect. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setboundingsize TB_SETBOUNDINGSIZE = WindowMessage.WM_USER + 93, /// /// Sets the hot item in a toolbar. /// Parameters /// wParam /// Index of the item that will be made hot. If this value is -1, none of the items will be hot. /// lParam /// A combination of HICF\_xxx flags. See /// **NMTBHOTITEM** /// . /// Returns /// Returns the index of the previous hot item, or -1 if there was no hot item. /// /// The behavior of this message is not defined for toolbars that do not have the TBSTYLE_FLAT style. // https://docs.microsoft.com/en-us/windows/win32/controls/tb-sethotitem2 TB_SETHOTITEM2 = WindowMessage.WM_USER + 94, /// /// /// [Intended for internal use; not recommended for use in applications. This message may not be supported in future versions of Windows.] /// /// Retrieves a count of toolbar buttons that have the specified accelerator character. /// Parameters /// wParam /// A WCHAR representing the input accelerator character to test. /// lParam /// Pointer to an int that receives the number of buttons that have the accelerator character. /// Returns /// The return value is not used. /// /// /// First, the system queries all toolbar buttons for matching accelerators. If no matches are found, the system sends the /// TBN_MAPACCELERATOR notification to the parent window, requesting the index of the button that has the specified accelerator /// character. If the parent provides an index, the count is set to 1. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-hasaccelerator TB_HASACCELERATOR = WindowMessage.WM_USER + 95, /// /// Sets the distance between the toolbar buttons on a specific toolbar. /// Parameters /// wParam /// The gap, in pixels, between buttons on the toolbar. /// lParam /// Ignored. /// Returns /// No return value. /// /// /// The gap between buttons only applies to the toolbar control window that receives this message. Receipt of this message /// triggers a repaint of the toolbar, if the toolbar is currently visible. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setlistgap TB_SETLISTGAP = WindowMessage.WM_USER + 96, /// /// Gets the number of image lists associated with the toolbar. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the number of image lists. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getimagelistcount TB_GETIMAGELISTCOUNT = WindowMessage.WM_USER + 98, /// /// Gets the ideal size of the toolbar. /// Parameters /// wParam /// /// A **BOOL** that indicates whether to retrieve the ideal height or width of the toolbar. Use **TRUE** to retrieve the ideal /// height, **FALSE** to retrieve the ideal width. /// /// lParam /// /// Pointer to a SIZE structure that receives the height or width at which all buttons would be displayed. If wParam is /// TRUE, only the cy member (height) is valid. If wParam is FALSE, only the cx member (width) is valid. /// /// Returns /// Returns TRUE if successful, or FALSE otherwise. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getidealsize TB_GETIDEALSIZE = WindowMessage.WM_USER + 99, /// /// Retrieves the metrics of a toolbar control. /// Parameters /// wParam /// Must be zero. /// lParam /// Pointer to a TBMETRICS structure that receives the toolbar metrics. /// Returns /// The return value is not used. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getmetrics TB_GETMETRICS = WindowMessage.WM_USER + 101, /// /// Sets the metrics of a toolbar control. /// Parameters /// wParam /// Must be zero. /// lParam /// TBMETRICS structure that contains the toolbar metrics to set. /// Returns /// The return value is not used. /// /// /// Note /// /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see /// Enabling Visual Styles. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setmetrics TB_SETMETRICS = WindowMessage.WM_USER + 102, /// /// Gets the bounding rectangle of the dropdown window for a toolbar item with style BTNS_DROPDOWN. /// Parameters /// wParam /// The zero-based index of the toolbar control item for which to retrieve the bounding rectangle. /// lParam /// A pointer to a /// **RECT** /// /// structure to receive the bounding rectangle information. The message sender is responsible for allocating this structure. The /// coordinates returned in the **RECT** structure are expressed as client coordinates. /// /// Returns /// Always returns nonzero. /// /// The item must have the BTNS_DROPDOWN style. // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getitemdropdownrect TB_GETITEMDROPDOWNRECT = WindowMessage.WM_USER + 103, /// /// Sets the image list that the toolbar uses to display buttons that are in a pressed state. /// Parameters /// wParam /// /// The index of the image list. If you use only one image list, set this parameter to zero. See Remarks for details on using /// multiple image lists. /// /// lParam /// Handle to the image list to set. If this parameter is NULL, no images are displayed in the buttons. /// Returns /// /// Returns the handle to the image list previously used to display buttons in their pressed state, or NULL if no such /// image list was previously set. /// /// /// /// /// Note /// Your application is responsible for freeing the image list after the toolbar is destroyed. /// /// /// The TB_SETPRESSEDIMAGELIST message cannot be combined with TB_ADDBITMAP. It also cannot be used with toolbars /// created with CreateToolbarEx, which calls TB_ADDBITMAP internally. When you create a toolbar with /// CreateToolbarEx or use TB_ADDBITMAP to add images, the toolbar manages the image list internally. Attempting to /// modify it with TB_SETPRESSEDIMAGELIST has unpredictable consequences. /// /// Button images need not come from the same image list. To use multiple image lists for your toolbar button images: /// /// /// /// Enable multiple image lists by sending the toolbar control a CCM_SETVERSION message with wParam (the version number) /// set to 5. /// /// /// /// /// For each image list you want to use, send the toolbar control a TB_SETPRESSEDIMAGELIST message. Set wParam to an /// application-defined wParam value that will be used to identify the list. Set lParam to the list's HIMAGELIST handle. /// /// /// /// /// For each button, set the iBitmap member of the button's TBBUTTON structure to MAKELONG(iIndex, iImageID). The /// iImageID value is the ID of the appropriate image list that was defined in step two. The iIndex value is the index of the /// particular image within that list. /// /// /// /// Add the buttons by sending the toolbar control a TB_ADDBUTTONS message. /// /// /// /// The following code fragment illustrates how to add five buttons to a toolbar, with images from three different image lists. /// Support for multiple image lists is enabled with a CCM_SETVERSION message. The image lists are then set and assigned /// IDs of 0-2. The buttons are assigned images from the image lists as follows: /// /// /// /// Button 0 is from image list zero (ahim[0]) with index of 1. /// /// /// Button 1 is from image list one (ahim[1]) with an index of 1. /// /// /// Button 2 is from image list two (ahim[2]) with an index of 1. /// /// /// Button 3 is from image list zero (ahim[0]) with an index of 2. /// /// /// Button 4 is from image list one (ahim[1]) with an index of 3. /// /// /// Finally, the buttons are added to the toolbar control with a TB_ADDBUTTONS message. /// /// // Enable multiple image lists SendMessage(hwndTB, CCM_SETVERSION, (WPARAM) 5, 0); //Set the image lists and assign them IDs of 0-2 SendMessage(hwndTB, TB_SETPRESSEDIMAGELIST, 0, (LPARAM)ahiml[0]); SendMessage(hwndTB, TB_SETPRESSEDIMAGELIST, 1, (LPARAM)ahiml[1]); SendMessage(hwndTB, TB_SETPRESSEDIMAGELIST, 2, (LPARAM)ahiml[2]); // Create the five buttons TBBUTTON rgtb[5]; //... initialize the TBBUTTON structures as usual ... //Assign images to each button rgtb[0].iBitmap = MAKELONG(1, 0); rgtb[1].iBitmap = MAKELONG(1, 1); rgtb[2].iBitmap = MAKELONG(1, 2); rgtb[3].iBitmap = MAKELONG(2, 0); rgtb[4].iBitmap = MAKELONG(3, 1); // Add the five buttons to the toolbar control SendMessage(hwndTB, TB_ADDBUTTONS, 5, (LPARAM)(&rgtb); /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-setpressedimagelist TB_SETPRESSEDIMAGELIST = WindowMessage.WM_USER + 104, /// /// Gets the image list that a toolbar control uses to display buttons in a pressed state. /// Parameters /// wParam /// Must be zero. /// lParam /// Must be zero. /// Returns /// Returns the handle to the image list, or NULL if no image list is set. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tb-getpressedimagelist TB_GETPRESSEDIMAGELIST = WindowMessage.WM_USER + 105, } /// Toolbar Control Notifications [PInvokeData("Commctrl.h")] public enum ToolbarNotification { /// /// /// 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_GETBUTTONINFO lpnmtb = (LPNMTOOLBAR) lParam; /// /// Parameters /// lParam /// /// Pointer to 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. /// /// Returns /// Returns TRUE if button information was copied to the specified structure, or FALSE otherwise. /// /// /// 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. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-getbuttoninfo TBN_GETBUTTONINFOA = TBN_FIRST - 0, /// /// /// 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_BEGINDRAG lpnmtb = (LPNMTOOLBAR) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMTOOLBAR structure. The iItem member contains the command identifier of the button being dragged. /// /// Returns /// No return value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-begindrag TBN_BEGINDRAG = TBN_FIRST - 1, /// /// /// 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_ENDDRAG lpnmtb = (LPNMTOOLBAR) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMTOOLBAR structure. The iItem member contains the command identifier of the button being dragged. /// /// Returns /// No return value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-enddrag TBN_ENDDRAG = TBN_FIRST - 2, /// /// /// Notifies a toolbar's parent window that the user has begun customizing a toolbar. This notification code is sent in the form /// of a WM_NOTIFY message. /// /// /// TBN_BEGINADJUST lpnmhdr = (LPNMHDR) lParam; /// /// Parameters /// lParam /// Pointer to an NMHDR structure that contains information about the notification code. /// Returns /// No return value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-beginadjust TBN_BEGINADJUST = TBN_FIRST - 3, /// /// /// 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_ENDADJUST lpnmhdr = (LPNMHDR) lParam; /// /// Parameters /// lParam /// Pointer to an NMHDR structure that contains information about the notification code. /// Returns /// No return value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-endadjust TBN_ENDADJUST = TBN_FIRST - 4, /// /// /// 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_RESET lpnmhdr = (LPNMHDR) lParam; /// /// Parameters /// lParam /// Pointer to an NMHDR structure that contains information about the notification code. /// Returns /// Return TBNRF_ENDCUSTOMIZE to close the Customize Toolbar dialog box. All other return values are ignored. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-reset TBN_RESET = TBN_FIRST - 5, /// /// /// 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_QUERYINSERT lpnmtb = (LPNMTOOLBAR) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMTOOLBAR structure. The iItem member contains the zero-based index of the button to be inserted. /// /// Returns /// /// Return TRUE to allow a button to be inserted in front of the given button, or FALSE to prevent the button from /// being inserted. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-queryinsert TBN_QUERYINSERT = TBN_FIRST - 6, /// /// /// 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_QUERYDELETE lpnmtb = (LPNMTOOLBAR) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMTOOLBAR structure. The iItem member contains the zero-based index of the button to be deleted. /// /// Returns /// Returns TRUE to allow the button to be deleted, or FALSE to prevent the button from being deleted. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-querydelete TBN_QUERYDELETE = TBN_FIRST - 7, /// /// /// 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_TOOLBARCHANGE lpnmhdr = (LPNMHDR) lParam; /// /// Parameters /// lParam /// Pointer to an NMHDR structure that contains information about the notification code. /// Returns /// No return value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-toolbarchange TBN_TOOLBARCHANGE = TBN_FIRST - 8, /// /// /// 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_CUSTHELP lpnmhdr = (LPNMHDR) lParam; /// /// Parameters /// lParam /// Pointer to an NMHDR structure that contains information about the notification code. /// Returns /// No return value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-custhelp TBN_CUSTHELP = TBN_FIRST - 9, /// /// /// 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_DROPDOWN lpnmtb = (LPNMTOOLBAR) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMTOOLBAR structure that contains information about this notification code. For this notification code, /// only the hdr and iItem members of this structure are valid. /// /// Returns /// Returns one of the following values: /// /// /// Return code /// Description /// /// /// TBDDRET_DEFAULT /// The drop-down was handled. /// /// /// TBDDRET_NODEFAULT /// The drop-down was not handled. /// /// /// TBDDRET_TREATPRESSED /// The drop-down was handled, but treat the button like a regular button. /// /// /// /// /// Note /// /// Dropdown buttons can be plain ( BTNS_DROPDOWN style), display an arrow next to the button image ( /// BTNS_WHOLEDROPDOWN style), or display an arrow that is separated from the image ( TBSTYLE_EX_DRAWDDARROWS /// style). If a separated arrow is used, TBN_DROPDOWN is sent only if the user clicks the arrow portion of the button. If the /// user clicks the main part of the button, a WM_COMMAND message with button's ID is sent, just as with a standard /// button. For the other two styles of dropdown button, TBN_DROPDOWN is sent when the user clicks any part of the button. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-dropdown TBN_DROPDOWN = TBN_FIRST - 10, /// /// /// 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_GETOBJECT lpnmon = (LPNMOBJECTNOTIFY) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMOBJECTNOTIFY structure that contains information about the button that the pointer passed over and /// receives data the application provides in response to this notification code. /// /// Returns /// The application processing this notification code must return zero. /// /// /// /// To provide an object, an application must set values in some members of the NMOBJECTNOTIFY structure at lParam. 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. /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-getobject TBN_GETOBJECT = TBN_FIRST - 12, /// /// /// 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_HOTITEMCHANGE lpnmhi = (LPNMTBHOTITEM) lParam; /// /// Parameters /// lParam /// Pointer to an NMTBHOTITEM structure that contains information about this notification code. /// Returns /// Return zero to allow the item to be highlighted, or nonzero to prevent the item from being highlighted. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-hotitemchange TBN_HOTITEMCHANGE = TBN_FIRST - 13, /// /// /// 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_DRAGOUT lpnmtb = (LPNMTOOLBAR) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMTOOLBAR structure that contains information about this notification code. For this notification code, /// 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. /// /// Returns /// The return value is ignored. /// /// /// This notification code allows an application to implement drag-and-drop functionality for toolbar buttons. When processing /// this notification code, the application will begin the drag-and-drop operation. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-dragout TBN_DRAGOUT = TBN_FIRST - 14, /// /// /// Sent by a toolbar control when a button is about to be deleted. This notification code is sent in the form of a /// WM_NOTIFY message. /// /// /// TBN_DELETINGBUTTON lpnmtb = (LPNMTOOLBAR) lParam; /// /// Parameters /// lParam /// /// Pointer to an NMTOOLBAR structure that contains information about the button being deleted. For this notification /// code, 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. /// /// Returns /// The return value is ignored. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-deletingbutton TBN_DELETINGBUTTON = TBN_FIRST - 15, /// /// /// Retrieves display information for a toolbar item. This notification code is sent in the form of a WM_NOTIFY message. /// /// /// TBN_GETDISPINFO lptbdi = (LPNMTBDISPINFO) lParam; /// /// Parameters /// lParam /// /// Pointer to 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. /// /// Returns /// The return value is ignored by the control. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-getdispinfo TBN_GETDISPINFOA = TBN_FIRST - 16, /// /// /// Retrieves display information for a toolbar item. This notification code is sent in the form of a WM_NOTIFY message. /// /// /// TBN_GETDISPINFO lptbdi = (LPNMTBDISPINFO) lParam; /// /// Parameters /// lParam /// /// Pointer to 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. /// /// Returns /// The return value is ignored by the control. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-getdispinfo TBN_GETDISPINFOW = TBN_FIRST - 17, /// /// /// Retrieves infotip information for a toolbar item. This notification code is sent in the form of a WM_NOTIFY message. /// /// /// TBN_GETINFOTIP lptbgit = (LPNMTBGETINFOTIP) lParam; /// /// Parameters /// lParam /// Pointer to an NMTBGETINFOTIP structure that contains item information and receives infotip information. /// Returns /// The return value is ignored by the control. /// /// /// The infotip support in the toolbar allows the toolbar to display tooltips for items that are as large as INFOTIPSIZE /// characters. If this notification code is not processed, the toolbar will use the item's text for the infotip. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-getinfotip TBN_GETINFOTIPA = TBN_FIRST - 18, /// /// /// Retrieves infotip information for a toolbar item. This notification code is sent in the form of a WM_NOTIFY message. /// /// /// TBN_GETINFOTIP lptbgit = (LPNMTBGETINFOTIP) lParam; /// /// Parameters /// lParam /// Pointer to an NMTBGETINFOTIP structure that contains item information and receives infotip information. /// Returns /// The return value is ignored by the control. /// /// /// The infotip support in the toolbar allows the toolbar to display tooltips for items that are as large as INFOTIPSIZE /// characters. If this notification code is not processed, the toolbar will use the item's text for the infotip. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-getinfotip TBN_GETINFOTIPW = TBN_FIRST - 19, /// /// /// 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_GETBUTTONINFO lpnmtb = (LPNMTOOLBAR) lParam; /// /// Parameters /// lParam /// /// Pointer to 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. /// /// Returns /// Returns TRUE if button information was copied to the specified structure, or FALSE otherwise. /// /// /// 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. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-getbuttoninfo TBN_GETBUTTONINFOW = TBN_FIRST - 20, /// /// /// 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_RESTORE lpnmtb = (LPNMTBRESTORE) lParam; /// /// Parameters /// lParam /// Pointer to an NMTBRESTORE structure. /// Returns /// /// The application should return zero in response to the first TBN_RESTORE notification code received at the start of the /// restore process to continue restoring the button information. If the application returns a nonzero value, the restore process /// is canceled. /// /// /// /// The application will receive this notification code once at the start of the restore process and once for each button. This /// notification code gives you an opportunity to extract the information from the data stream that you saved previously. If you /// haven't saved any information, ignore the notification code. See Toolbar Customization for a more detailed discussion of how /// to handle TBN_RESTORE. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-restore TBN_RESTORE = TBN_FIRST - 21, /// /// /// 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_SAVE lpnmtb = (LPNMTBSAVE) lParam; /// /// Parameters /// lParam /// Pointer to an NMTBSAVE structure. /// Returns /// No return value. /// /// /// The application will receive this notification code once at the start of the save process and once for each button. This /// notification code gives you an opportunity to add your own information to that saved by the Shell. If you do not wish to add /// information, ignore the notification code. See Toolbar Customization for a more detailed discussion of how to handle TBN_SAVE. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-save TBN_SAVE = TBN_FIRST - 22, /// /// /// Notifies a toolbar's parent window that customizing has started. This notification code is sent in the form of a /// WM_NOTIFY message. /// /// /// TBN_INITCUSTOMIZE lpnmhdr = (LPNMHDR) lParam; /// /// Parameters /// lParam /// Pointer to the toolbar's NMHDR structure. /// Returns /// Returns TBNRF_HIDEHELP to suppress the Help button. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-initcustomize TBN_INITCUSTOMIZE = TBN_FIRST - 23, /// /// /// 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. /// /// /// TBN_WRAPHOTITEM lpnmtb = (NMTBWRAPHOTITEM) lParam; /// /// Parameters /// lParam /// /// A pointer to a structure that contains the old hot item ( iStart) and whether the new hot item is before it ( /// iDir = -1) or after it ( iDir = 1), as well as a reason why the hot item is changing. /// /// Returns /// TRUE if the application is handling the hot item change itself; otherwise FALSE. /// /// /// The NMTBWRAPHOTITEM structure must be defined by the application as follows: /// /// typedef struct tagNMTBWRAPHOTITEM { NMHDR hdr; int iStart; int iDir; UINT nReason; // HICF_* flags } NMTBWRAPHOTITEM, *LPNMTBWRAPHOTITEM; /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-wraphotitem TBN_WRAPHOTITEM = TBN_FIRST - 24, /// /// /// 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_DUPACCELERATOR lpnmtb = (NMTBDUPACCELERATOR) lParam; /// /// Parameters /// lParam /// /// A pointer to a structure that provides an accelerator and that receives a value specifying whether multiple toolbars respond /// to the same character. /// /// Returns /// Returns TRUE if successful, otherwise FALSE. /// /// /// The application must declare the NMTBDUPACCELERATOR structure as follows: /// /// typedef struct tagNMTBDUPACCELERATOR { NMHDR hdr; UINT ch; // The accelerator. BOOL fDup; // TRUE if multiple toolbars respond to the accelerator. } NMTBDUPACCELERATOR, *LPNMTBDUPACCELERATOR; /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-dupaccelerator TBN_DUPACCELERATOR = TBN_FIRST - 25, /// /// /// 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_WRAPACCELERATOR lpnmtb = (NMTBWRAPACCELERATOR) lParam; /// /// Parameters /// lParam /// /// A pointer to a structure that contains the accelerator key character, and that receives the index of the corresponding /// button. The index is -1 if the accelerator does not correspond to a command. /// /// Returns /// TRUE if an index is returned, otherwise FALSE. /// /// /// Applications with one or more toolbars may receive this notification code. /// The NMTBWRAPACCELERATOR structure must be defined by the application as follows: /// /// typedef struct tagNMTBWRAPACCELERATOR { NMHDR hdr; UINT ch; int iButton; } NMTBWRAPACCELERATOR, *LPNMTBWRAPACCELERATOR; /// /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-wrapaccelerator TBN_WRAPACCELERATOR = TBN_FIRST - 26, /// /// /// 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_DRAGOVER lpnmtb = (NMTBHOTITEM*) lParam; /// /// Parameters /// lParam /// A pointer to an NMTBHOTITEM structure that specifies which item is being dragged over. /// Returns /// FALSE if the toolbar should send a TB_MARKBUTTON message; otherwise TRUE. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-dragover TBN_DRAGOVER = TBN_FIRST - 27, /// /// /// 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_MAPACCELERATOR lpnmtb = (NMCHAR*) lParam; /// /// Parameters /// lParam /// /// A pointer to an NMCHAR structure that contains the accelerator key character and that receives the index of the /// corresponding button. The dwItemNext field is -1 if the accelerator does not correspond to a command. /// /// Returns /// TRUE if NMCHAR.dwItemNext is set to a value. /// // https://docs.microsoft.com/en-us/windows/win32/controls/tbn-mapaccelerator TBN_MAPACCELERATOR = TBN_FIRST - 28, } /// Toolbar Control and Button Styles [PInvokeData("CommCtrl.h")] [Flags] public enum ToolbarStyle : ushort { /// /// Allows users to change a toolbar button's position by dragging it while holding down the ALT key. If this style is not /// specified, the user must hold down the SHIFT key while dragging a button. Note that the CCS_ADJUSTABLE style must be /// specified to enable toolbar buttons to be dragged. /// TBSTYLE_ALTDRAG = 0x0400, /// Equivalent to BTNS_AUTOSIZE. Use TBSTYLE_AUTOSIZE for version 4.72 and earlier. TBSTYLE_AUTOSIZE = 0x0010, /// Equivalent to BTNS_BUTTON. Use TBSTYLE_BUTTON for version 4.72 and earlier. TBSTYLE_BUTTON = 0x0000, /// Equivalent to BTNS_CHECK. Use TBSTYLE_CHECK for version 4.72 and earlier. TBSTYLE_CHECK = 0x0002, /// Equivalent to BTNS_CHECKGROUP. Use TBSTYLE_CHECKGROUP for version 4.72 and earlier. TBSTYLE_CHECKGROUP = (TBSTYLE_GROUP | TBSTYLE_CHECK), /// Version 4.70. Generates NM_CUSTOMDRAW notification codes when the toolbar processes WM_ERASEBKGND messages. TBSTYLE_CUSTOMERASE = 0x2000, /// Equivalent to BTNS_DROPDOWN. Use TBSTYLE_DROPDOWN for version 4.72 and earlier. TBSTYLE_DROPDOWN = 0x0008, /// /// Version 4.70. Creates a flat toolbar. In a flat toolbar, both the toolbar and the buttons are transparent and hot-tracking is /// enabled. Button text appears under button bitmaps. To prevent repainting problems, this style should be set before the /// toolbar control becomes visible. /// TBSTYLE_FLAT = 0x0800, /// Equivalent to BTNS_GROUP. Use TBSTYLE_GROUP for version 4.72 and earlier. TBSTYLE_GROUP = 0x0004, /// /// Version 4.70. Creates a flat toolbar with button text to the right of the bitmap. Otherwise, this style is identical to /// TBSTYLE_FLAT. To prevent repainting problems, this style should be set before the toolbar control becomes visible. /// TBSTYLE_LIST = 0x1000, /// Equivalent to BTNS_NOPREFIX. Use TBSTYLE_NOPREFIX for version 4.72 and earlier. TBSTYLE_NOPREFIX = 0x0020, /// /// Version 4.71. Generates TBN_GETOBJECT notification codes to request drop target objects when the cursor passes over toolbar buttons. /// TBSTYLE_REGISTERDROP = 0x4000, /// Equivalent to BTNS_SEP. Use TBSTYLE_SEP for version 4.72 and earlier. TBSTYLE_SEP = 0x0001, /// Creates a tooltip control that an application can use to display descriptive text for the buttons in the toolbar. TBSTYLE_TOOLTIPS = 0x0100, /// /// Version 4.71. Creates a transparent toolbar. In a transparent toolbar, the toolbar is transparent but the buttons are not. /// Button text appears under button bitmaps. To prevent repainting problems, this style should be set before the toolbar control /// becomes visible. /// TBSTYLE_TRANSPARENT = 0x8000, /// /// Creates a toolbar that can have multiple lines of buttons. Toolbar buttons can "wrap" to the next line when the toolbar /// becomes too narrow to include all buttons on the same line. When the toolbar is wrapped, the break will occur on either the /// rightmost separator or the rightmost button if there are no separators on the bar. This style must be set to display a /// vertical toolbar control when the toolbar is part of a vertical rebar control. This style cannot be combined with CCS_VERT. /// TBSTYLE_WRAPABLE = 0x0200, /// /// Version 5.80. Creates a standard button. Use the equivalent style flag, TBSTYLE_BUTTON, for version 4.72 and earlier. This /// flag is defined as 0, and should be used to signify that no other flags are set. /// BTNS_BUTTON = TBSTYLE_BUTTON, /// /// Version 5.80. Creates a separator, providing a small gap between button groups. A button that has this style does not receive /// user input. Use the equivalent style flag, TBSTYLE_SEP, for version 4.72 and earlier. /// BTNS_SEP = TBSTYLE_SEP, /// /// Version 5.80. Creates a dual-state push button that toggles between the pressed and nonpressed states each time the user /// clicks it. The button has a different background color when it is in the pressed state. Use the equivalent style flag, /// TBSTYLE_CHECK, for version 4.72 and earlier. /// BTNS_CHECK = TBSTYLE_CHECK, /// /// Version 5.80. When combined with BTNS_CHECK, creates a button that stays pressed until another button in the group is /// pressed. Use the equivalent style flag, TBSTYLE_GROUP, for version 4.72 and earlier. /// BTNS_GROUP = TBSTYLE_GROUP, /// /// Version 5.80. Creates a button that stays pressed until another button in the group is pressed, similar to option buttons /// (also known as radio buttons). It is equivalent to combining BTNS_CHECK and BTNS_GROUP. Use the equivalent style flag, /// TBSTYLE_CHECKGROUP, for version 4.72 and earlier. /// BTNS_CHECKGROUP = TBSTYLE_CHECKGROUP, /// /// Version 5.80. Creates a drop-down style button that can display a list when the button is clicked. Instead of the WM_COMMAND /// message used for normal buttons, drop-down buttons send a TBN_DROPDOWN notification code. An application can then have the /// notification handler display a list of options. Use the equivalent style flag, TBSTYLE_DROPDOWN, for version 4.72 and earlier. /// /// If the toolbar has the TBSTYLE_EX_DRAWDDARROWS extended style, drop-down buttons will have a drop-down arrow displayed in a /// separate section to their right. If the arrow is clicked, a TBN_DROPDOWN notification code will be sent. If the associated /// button is clicked, a WM_COMMAND message will be sent. /// /// BTNS_DROPDOWN = TBSTYLE_DROPDOWN, /// /// Version 5.80. Specifies that the toolbar control should not assign the standard width to the button. Instead, the button's /// width will be calculated based on the width of the text plus the image of the button. Use the equivalent style flag, /// TBSTYLE_AUTOSIZE, for version 4.72 and earlier. /// BTNS_AUTOSIZE = TBSTYLE_AUTOSIZE, /// /// Version 5.80. Specifies that the button text will not have an accelerator prefix associated with it. Use the equivalent style /// flag, TBSTYLE_NOPREFIX, for version 4.72 and earlier. /// BTNS_NOPREFIX = TBSTYLE_NOPREFIX, /// /// Version 5.81. Specifies that button text should be displayed. All buttons can have text, but only those buttons with the /// BTNS_SHOWTEXT button style will display it. This button style must be used with the TBSTYLE_LIST style and the /// TBSTYLE_EX_MIXEDBUTTONS extended style. If you set text for buttons that do not have the BTNS_SHOWTEXT style, the toolbar /// control will automatically display it as a tooltip when the cursor hovers over the button. This feature allows your /// application to avoid handling the TBN_GETINFOTIP or TTN_GETDISPINFO notification code for the toolbar. /// BTNS_SHOWTEXT = 0x0040, /// /// Version 5.80. Specifies that the button will have a drop-down arrow, but not as a separate section. Buttons with this style /// behave the same, regardless of whether the TBSTYLE_EX_DRAWDDARROWS extended style is set. /// BTNS_WHOLEDROPDOWN = 0x0080, } /// This section lists the extended styles supported by toolbar controls. // https://msdn.microsoft.com/en-us/library/windows/desktop/bb760430(v=vs.85).aspx [PInvokeData("CommCtrl.h", MSDNShortId = "bb760430")] [Flags] public enum ToolbarStyleEx { /// /// Version 4.71. This style allows buttons to have a separate dropdown arrow. Buttons that have the BTNS_DROPDOWN style will be /// drawn with a dropdown arrow in a separate section, to the right of the button. If the arrow is clicked, only the arrow /// portion of the button will depress, and the toolbar control will send a TBN_DROPDOWN notification code to prompt the /// application to display the dropdown menu. If the main part of the button is clicked, the toolbar control sends a WM_COMMAND /// message with the button's ID. The application normally responds by launching the first command on the menu. There are many /// situations where you may want to have only some of the dropdown buttons on a toolbar with separated arrows. To do so, set the /// TBSTYLE_EX_DRAWDDARROWS extended style. Give those buttons that will not have separated arrows the BTNS_WHOLEDROPDOWN style. /// Buttons with this style will have an arrow displayed next to the image. However, the arrow will not be separate and when any /// part of the button is clicked, the toolbar control will send a TBN_DROPDOWN notification code. To prevent repainting /// problems, this style should be set before the toolbar control becomes visible. /// TBSTYLE_EX_DRAWDDARROWS = 0x00000001, /// /// Version 5.81. This style allows you to set text for all buttons, but only display it for those buttons with the BTNS_SHOWTEXT /// button style. The TBSTYLE_LIST style must also be set. Normally, when a button does not display text, your application must /// handle TBN_GETINFOTIP or TTN_GETDISPINFO to display a tooltip. With the TBSTYLE_EX_MIXEDBUTTONS extended style, text that is /// set but not displayed on a button will automatically be used as the button's tooltip text. Your application only needs to /// handle TBN_GETINFOTIP or or TTN_GETDISPINFO if it needs more flexibility in specifying the tooltip text. /// TBSTYLE_EX_MIXEDBUTTONS = 0x00000008, /// /// Version 5.81. This style hides partially clipped buttons. The most common use of this style is for toolbars that are part of /// a rebar control. If an adjacent band covers part of a button, the button will not be displayed. However, if the rebar band /// has the RBBS_USECHEVRON style, the button will be displayed on the chevron's dropdown menu. /// TBSTYLE_EX_HIDECLIPPEDBUTTONS = 0x00000010, /// /// Version 5.82. Intended for internal use; not recommended for use in applications. This style gives the toolbar a vertical /// orientation and organizes the toolbar buttons into columns. The buttons flow down vertically until a button has exceeded the /// bounding height of the toolbar (see TB_SETBOUNDINGSIZE), and then a new column is created. The toolbar flows the buttons in /// this manner until all buttons are positioned. To use this style, the TBSTYLE_EX_VERTICAL style must also be set. /// TBSTYLE_EX_MULTICOLUMN = 0x00000002, /// /// Version 5.82. Intended for internal use; not recommended for use in applications. This style gives the toolbar a vertical /// orientation. Toolbar buttons flow from top to bottom instead of horizontally. /// TBSTYLE_EX_VERTICAL = 0x00000004, /// /// Version 6. This style requires the toolbar to be double buffered. Double buffering is a mechanism that detects when the /// toolbar has changed. /// TBSTYLE_EX_DOUBLEBUFFER = 0x00000080, } /// Index values for IDB_VIEW_LARGE_COLOR and IDB_VIEW_SMALL_COLOR [PInvokeData("Commctrl.h")] public enum VIEW { /// Large icons view. VIEW_LARGEICONS = 0, /// Small icons view. VIEW_SMALLICONS = 1, /// List view. VIEW_LIST = 2, /// Details view. VIEW_DETAILS = 3, /// Sort by name. VIEW_SORTNAME = 4, /// Sort by size. VIEW_SORTSIZE = 5, /// Sort by date. VIEW_SORTDATE = 6, /// Sort by type. VIEW_SORTTYPE = 7, /// Go to parent folder. VIEW_PARENTFOLDER = 8, /// Connect to network drive. VIEW_NETCONNECT = 9, /// Disconnect to network drive. VIEW_NETDISCONNECT = 10, /// New folder. VIEW_NEWFOLDER = 11, /// View menu. VIEW_VIEWMENU = 12, } /// Creates a bitmap for use in a toolbar. /// /// Type: HINSTANCE /// Handle to the module instance with the executable file that contains the bitmap resource. /// /// /// Type: INT_PTR /// Resource identifier of the bitmap resource. /// /// /// Type: UINT /// Bitmap flag. This parameter can be zero or the following value: /// /// /// /// Value /// Meaning /// /// /// CMB_MASKED /// Uses a bitmap as a mask. /// /// /// /// /// /// Type: LPCOLORMAP /// /// Pointer to a COLORMAP structure that contains the color information needed to map the bitmaps. If this parameter is /// NULL, the function uses the default color map. /// /// /// /// Type: int /// Number of color maps pointed to by lpColorMap. /// /// /// Type: HBITMAP /// /// Returns the handle to the bitmap if successful, or NULL otherwise. To retrieve extended error information, call GetLastError. /// /// // HBITMAP CreateMappedBitmap( HINSTANCE hInstance, INT_PTR idBitmap, UINT wFlags, _In_ LPCOLORMAP lpColorMap, int iNumMaps); https://msdn.microsoft.com/en-us/library/windows/desktop/bb787467(v=vs.85).aspx [DllImport(Lib.ComCtl32, SetLastError = true, ExactSpelling = true)] [PInvokeData("Commctrl.h", MSDNShortId = "bb787467")] public static extern IntPtr CreateMappedBitmap(HINSTANCE hInstance, SafeResourceId idBitmap, CMB wFlags, in COLORMAP lpColorMap, int iNumMaps); /// Contains information used by the CreateMappedBitmap function to map the colors of the bitmap. // typedef struct _COLORMAP { COLORREF from; COLORREF to;} COLORMAP, *LPCOLORMAP; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760448(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760448")] public struct COLORMAP { /// /// Type: COLORREF /// Color to map from. /// public COLORREF from; /// /// Type: COLORREF /// Color to map to. /// public COLORREF to; } /// /// Contains and receives display information for a toolbar item. This structure is used with the TBN_GETDISPINFO notification code. /// // typedef struct { NMHDR hdr; DWORD dwMask; int idCommand; DWORD_PTR lParam; int iImage; LPTSTR pszText; int cchText;} NMTBDISPINFO, // *LPNMTBDISPINFO; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760452(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760452")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct NMTBDISPINFO { /// /// Type: NMHDR /// NMHDR structure that contains additional information about the notification. /// public NMHDR hdr; /// /// Type: DWORD /// /// Set of flags that indicate which members of this structure are being requested. This can be one or more of the following values. /// /// /// /// /// Value /// Meaning /// /// /// 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. /// /// /// TBNF_DI_SETITEM /// /// Set this flag when processing TBN_GETDISPINFO; the toolbar control will retain the supplied information and not request it again. /// /// /// /// /// public TBNF dwMask; /// /// Type: int /// /// Command identifier of the item for which display information is being requested. This member is filled in by the control /// before it sends the notification code. /// /// public int idCommand; /// /// Type: DWORD_PTR /// /// Application-defined value associated with the item for which display information is being requested. This member is filled in /// by the control before sending the notification code. /// /// public IntPtr lParam; /// /// Type: int /// Image index for the item. /// public int iImage; /// /// Type: LPTSTR /// Pointer to a character buffer that receives the item's text. /// [MarshalAs(UnmanagedType.LPTStr)] public string pszText; /// /// Type: int /// Size of the pszText buffer, in characters. /// public int cchText; } /// /// Contains and receives infotip information for a toolbar item. This structure is used with the TBN_GETINFOTIP notification code. /// // typedef struct tagNMTBGETINFOTIP { NMHDR hdr; LPTSTR pszText; int cchTextMax; int iItem; LPARAM lParam;} NMTBGETINFOTIP, // *LPNMTBGETINFOTIP; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760454(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760454")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct NMTBGETINFOTIP { /// /// Type: NMHDR /// NMHDR structure that contains additional information about the notification. /// public NMHDR hdr; /// /// Type: LPTSTR /// Address of a character buffer that receives the infotip text. /// [MarshalAs(UnmanagedType.LPTStr)] public string pszText; /// /// Type: int /// /// Size of the buffer, in characters, at pszText. In most cases, the buffer will be INFOTIPSIZE characters in size, but /// you should always make sure that your application does not copy more than cchTextMax characters to the buffer at pszText. /// /// public int cchTextMax; /// /// Type: int /// /// The command identifier of the item for which infotip information is being requested. This member is filled in by the control /// before sending the notification code. /// /// public int iItem; /// /// Type: LPARAM /// /// The application-defined value associated with the item for which infotip information is being requested. This member is /// filled in by the control before sending the notification code. /// /// public IntPtr lParam; } /// Contains information used with the TBN_HOTITEMCHANGE notification code. // typedef struct tagNMTBHOTITEM { NMHDR hdr; int idOld; int idNew; DWORD dwFlags;} NMTBHOTITEM, *LPNMTBHOTITEM; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760456(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760456")] [StructLayout(LayoutKind.Sequential)] public struct NMTBHOTITEM { /// /// Type: NMHDR /// NMHDR structure that contains additional information about the notification. /// public NMHDR hdr; /// /// Type: int /// Command identifier of the previously highlighted item. /// public int idOld; /// /// Type: int /// Command identifier of the item about to be highlighted. /// public int idNew; /// /// Type: DWORD /// Flags that indicate why the hot item has changed. This can be one or more of the following values: /// /// /// /// Value /// Meaning /// /// /// HICF_ACCELERATOR /// The change in the hot item was caused by a shortcut key. /// /// /// HICF_ARROWKEYS /// The change in the hot item was caused by an arrow key. /// /// /// HICF_DUPACCEL /// Modifies HICF_ACCELERATOR. If this flag is set, more than one item has the same shortcut key 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_LMOUSE /// The change in the hot item resulted from a left-click mouse event. /// /// /// 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 shortcut key for an item that was already hot. /// /// /// HICF_TOGGLEDROPDOWN /// Version 5.80. Causes the button to switch states. /// /// /// /// public HICF dwFlags; // HICF_* } /// /// 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. /// // typedef struct tagNMTBRESTORE { NMHDR nmhdr; DWORD *pData; DWORD *pCurrent; UINT cbData; int iItem; int cButtons; int // cbBytesPerRecord; TBBUTTON tbButton;} NMTBRESTORE, *LPNMTBRESTORE; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760458(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760458")] [StructLayout(LayoutKind.Sequential)] public struct NMTBRESTORE { /// /// Type: NMHDR /// NMHDR structure that contains additional information about the notification. /// public NMHDR hdr; /// /// Type: DWORD* /// /// Pointer to the data stream with the stored save information. It contains Shell-defined blocks of information for each button, /// alternating with application-defined blocks. Applications may also place a block of global data at the start of pData. /// The format and length of the application-defined blocks are determined by the application. /// /// public IntPtr pData; /// /// Type: DWORD* /// /// Pointer to the current block of application-defined data. After extracting the data, the application must advance /// pCurrent to the end of the block, so it is pointing to the next block of Shell-defined data. /// /// public IntPtr pCurrent; /// /// Type: UINT /// Size of pData. /// public uint cbData; /// /// Type: int /// /// Value of -1 indicates that the restore is starting, and pCurrent will point to the start of the data stream. /// Otherwise, it is the zero-based button index, and pCurrent will point to the current button's data. /// /// public int iItem; /// /// Type: int /// /// Estimate of the number of buttons. Because the estimate is based on the size of the data stream, it might be incorrect. The /// client should update it as appropriate. /// /// public int cButtons; /// /// Type: int /// /// Number of bytes needed to hold the data for each button. When the restore starts, cbBytesPerRecord will be set to the /// size of the Shell-defined data structure. You need to increment it by the size of the structure that holds the /// application-defined data. /// /// public int cbBytesPerRecord; /// /// Type: TBBUTTON /// /// TBBUTTON structure that contains information about the button currently being restored. Applications must modify this /// structure as necessary before returning. /// /// public TBBUTTON tbButton; } /// /// 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. /// // typedef struct tagNMTBSAVE { NMHDR hdr; DWORD *pData; DWORD *pCurrent; UINT cbData; int iItem; int cButtons; TBBUTTON tbButton;} NMTBSAVE, // *LPNMTBSAVE; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760471(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760471")] [StructLayout(LayoutKind.Sequential)] public struct NMTBSAVE { /// /// Type: NMHDR /// An NMHDR structure that contains additional information about the notification. /// public NMHDR hdr; /// /// Type: DWORD* /// /// A pointer to the data stream used to store the save information. When complete, it will contain blocks of Shell-defined /// information for each button, alternating with blocks defined by the application. Applications may also choose to place a /// block of global data at the start of pData. The format and length of the application-defined blocks are determined by /// the application. When the save starts, the Shell will pass the amount of memory it needs in cbData, but no memory will /// be allocated. You must allocate enough memory for pData to hold your data, plus the Shell's. /// /// public IntPtr pData; /// /// Type: DWORD* /// /// A pointer to the start of the unused portion of the data stream. You should load your data here, and then advance /// pCurrent to the start of the remaining unused portion. The Shell will then load the information for the next button, /// advance pCurrent, and so on. /// /// public IntPtr pCurrent; /// /// Type: UINT /// /// The size of the data stream. When the save starts, cbData will be set to the amount of data needed by the Shell. You /// should change it to the total amount allocated. /// /// public uint cbData; /// /// Type: int /// /// This parameter is usually the zero-based index of the button currently being saved. It is set to -1 to indicate that a save /// is starting. /// /// public int iItem; /// /// Type: int /// /// An estimate of the number of buttons. Because it is based on the size of the data stream, it may be incorrect. The client /// should update it as appropriate. /// /// public int cButtons; /// /// Type: TBBUTTON /// A TBBUTTON structure that contains information about the button currently being saved. /// public TBBUTTON tbButton; } /// Contains information used to process toolbar notification codes. This structure supersedes the TBNOTIFY structure. // typedef struct tagNMTOOLBAR { NMHDR hdr; int iItem; TBBUTTON tbButton; int cchText; LPTSTR pszText; RECT rcButton;} NMTOOLBAR, // *LPNMTOOLBAR; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760473(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760473")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct NMTOOLBAR { /// /// Type: NMHDR /// NMHDR structure that contains additional information about the notification. /// public NMHDR hdr; /// /// Type: int /// Command identifier of the button associated with the notification code. /// public int iItem; /// /// Type: TBBUTTON /// /// TBBUTTON structure that contains information about the toolbar button associated with the notification code. This /// member only contains valid information with the TBN_QUERYINSERT and TBN_QUERYDELETE notification codes. /// /// public TBBUTTON tbButton; /// /// Type: int /// Count of characters in the button text. /// public int cchText; /// /// Type: LPTSTR /// Address of a character buffer that contains the button text. /// [MarshalAs(UnmanagedType.LPTStr)] public string pszText; /// /// Type: RECT /// Version 5.80. A RECT structure that defines the area covered by the button. /// public RECT rcButton; } /// Adds a bitmap that contains button images to a toolbar. // typedef struct { HINSTANCE hInst; UINT_PTR nID;} TBADDBITMAP, *LPTBADDBITMAP; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760475(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760475")] [StructLayout(LayoutKind.Sequential)] public struct TBADDBITMAP { /// /// Type: HINSTANCE /// /// Handle to the module instance with the executable file that contains a bitmap resource. To use bitmap handles instead of /// resource IDs, set this member to NULL. /// /// /// 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. /// /// /// /// /// Value /// Meaning /// /// /// IDB_STD_LARGE_COLOR /// Large, color standard bitmaps. /// /// /// IDB_STD_SMALL_COLOR /// Small, color standard bitmaps. /// /// /// IDB_VIEW_LARGE_COLOR /// Small large, color view bitmaps. /// /// /// IDB_VIEW_SMALL_COLOR /// Small, color view bitmaps. /// /// /// IDB_HIST_NORMAL /// Windows Explorer travel buttons and favorites bitmaps in normal state. /// /// /// IDB_HIST_HOT /// Windows Explorer travel buttons and favorites bitmaps in hot state. /// /// /// IDB_HIST_DISABLED /// Windows Explorer travel buttons and favorites bitmaps in disabled state. /// /// /// IDB_HIST_PRESSED /// Windows Explorer travel buttons and favorites bitmaps in pressed state. /// /// /// /// public HINSTANCE hInst; /// /// Type: UINT_PTR /// /// If hInst is NULL, set this member to the bitmap handle of the bitmap with the button images. Otherwise, set it /// to the resource identifier of the bitmap with the button images. /// /// public IntPtr nID; } /// Contains information about a button in a toolbar. // typedef struct { int iBitmap; int idCommand; BYTE fsState; BYTE fsStyle;#ifdef _WIN64 BYTE bReserved[6];#else #if defined(_WIN32) // BYTE bReserved[2];#endif #endif DWORD_PTR dwData; INT_PTR iString;} TBBUTTON, *PTBBUTTON, *LPTBBUTTON; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760476(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760476")] [StructLayout(LayoutKind.Sequential)] public struct TBBUTTON { /// /// Zero-based index of the button image. Set this member to I_IMAGECALLBACK, and the toolbar will send the TBN_GETDISPINFO /// notification code to retrieve the image index when it is needed. /// /// Version 5.81. Set this member to I_IMAGENONE to indicate that the button does not have an image.The button layout will not /// include any space for a bitmap, only text. /// /// /// If the button is a separator, that is, if fsStyle is set to BTNS_SEP, iBitmap determines the width of the separator, in /// pixels.For information on selecting button images from image lists, see TB_SETIMAGELIST message. /// /// public int iBitmap; /// /// Command identifier associated with the button. This identifier is used in a WM_COMMAND message when the button is chosen. /// public int idCommand; // Funky holder to make preprocessor directives work private TBBUTTON_U union; /// Button state flags. public TBSTATE fsState { get => union.fsState; set => union.fsState = value; } /// Button style. public ToolbarStyle fsStyle { get => union.fsStyle; set => union.fsStyle = value; } /// Application-defined value. public IntPtr dwData; /// Zero-based index of the button string, or a pointer to a string buffer that contains text for the button. public IntPtr iString; [StructLayout(LayoutKind.Explicit, Pack = 1)] private struct TBBUTTON_U { [FieldOffset(0)] private readonly IntPtr bReserved; [FieldOffset(0)] public TBSTATE fsState; [FieldOffset(1)] public ToolbarStyle fsStyle; } } /// Contains or receives information for a specific button in a toolbar. // typedef struct { UINT cbSize; DWORD dwMask; int idCommand; int iImage; BYTE fsState; BYTE fsStyle; WORD cx; DWORD_PTR lParam; // LPTSTR pszText; int cchText;} TBBUTTONINFO, *LPTBBUTTONINFO; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760478(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760478")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)] public struct TBBUTTONINFO { /// /// Type: UINT /// Size of the structure, in bytes. This member must be filled in prior to sending the associated message. /// public uint cbSize; /// /// Type: DWORD /// /// 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. /// /// /// /// /// Value /// Meaning /// /// /// TBIF_BYINDEX /// Version 5.80. The wParam sent with a TB_GETBUTTONINFO or TB_SETBUTTONINFO message is an index, not an identifier. /// /// /// 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. /// /// /// /// public TBIF dwMask; /// /// Type: int /// Command identifier of the button. /// public int idCommand; /// /// Type: int /// /// Image index of the button. Set this member to I_IMAGECALLBACK, and the toolbar will send the TBN_GETDISPINFO notification /// code to retrieve the image index when it is needed. /// /// /// Version 5.81. Set this member to I_IMAGENONE to indicate that the button does not have an image. The button layout will not /// include any space for a bitmap, only text. /// /// public int iImage; /// /// Type: BYTE /// State flags of the button. This can be one or more of the values listed in Toolbar Button States. /// public TBSTATE fsState; /// /// Type: BYTE /// Style flags of the button. This can be one or more of the values listed in Toolbar Control and Button Styles. /// public ToolbarStyle fsStyle { get => (ToolbarStyle)_fsStyle; set => _fsStyle = (byte)((ushort)fsStyle & 0x00FF); } private byte _fsStyle; /// /// Type: WORD /// Width of the button, in pixels. /// public ushort cx; /// /// Type: DWORD_PTR /// Application-defined value associated with the button. /// public IntPtr lParam; /// /// Type: LPTSTR /// Address of a character buffer that contains or receives the button text. /// public IntPtr pszText; /// /// Type: int /// Size of the buffer at pszText. If the button information is being set, this member is ignored. /// public int cchText; } /// Contains information on the insertion mark in a toolbar control. // typedef struct { int iButton; DWORD dwFlags;} TBINSERTMARK, *LPTBINSERTMARK; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760480(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760480")] [StructLayout(LayoutKind.Sequential)] public struct TBINSERTMARK { /// /// Type: int /// Zero-based index of the insertion mark. If this member is -1, there is no insertion mark. /// public int iButton; /// /// Type: DWORD /// Defines where the insertion mark is in relation to iButton. This can be one of the following values: /// /// /// /// Value /// Meaning /// /// /// 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. /// /// /// /// public TBIMHT dwFlags; } /// Defines the metrics of a toolbar that are used to shrink or expand toolbar items. // typedef struct { UINT cbSize; DWORD dwMask; int cxPad; int cyPad; int cxBarPad; int cyBarPad; int cxButtonSpacing; int // cyButtonSpacing;} TBMETRICS, // *LPTBMETRICS; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760482(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760482")] [StructLayout(LayoutKind.Sequential)] public struct TBMETRICS { /// /// Type: UINT /// Size of the TBMETRICS structure. /// public uint cbSize; /// /// Type: DWORD /// Mask that determines the metric to retrieve. It can be any combination of the following: /// /// /// /// Value /// Meaning /// /// /// TBMF_PAD /// Retrieve the cxPad and cyPad values. /// /// /// TBMF_BARPAD /// Retrieve the cxBarPad and cyBarPad values. /// /// /// TBMF_BUTTONSPACING /// Retrieve the cxButtonSpacing and cyButtonSpacing values. /// /// /// /// public TBMF dwMask; /// /// Type: int /// Width of the padding inside the toolbar buttons, between the content and the edge of the button. /// public int cxPad; /// /// Type: int /// Height of the padding inside the toolbar buttons, between the content and the edge of the button. /// public int cyPad; /// /// Type: int /// Width of the toolbar. Not used. /// public int cxBarPad; /// /// Type: int /// Height of the toolbar. Not used. /// public int cyBarPad; /// /// Type: int /// Width of the space between toolbar buttons. /// public int cxButtonSpacing; /// /// Type: int /// Height of the space between toolbar buttons. /// public int cyButtonSpacing; } /// Used with the TB_REPLACEBITMAP message to replace one toolbar bitmap with another. // typedef struct { HINSTANCE hInstOld; UINT_PTR nIDOld; HINSTANCE hInstNew; UINT_PTR nIDNew; int nButtons;} TBREPLACEBITMAP, // *LPTBREPLACEBITMAP; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760484(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760484")] [StructLayout(LayoutKind.Sequential)] public struct TBREPLACEBITMAP { /// /// Type: HINSTANCE /// /// Module instance handle to the bitmap resource being replaced. Set this member to NULL to instead use a bitmap handle. /// /// public HINSTANCE hInstOld; /// /// Type: UINT_PTR /// /// If hInstOld is NULL, set this member to the bitmap handle of the bitmap that is being replaced. Otherwise, set /// it to the resource identifier of the bitmap being replaced. /// /// public IntPtr nIDOld; /// /// Type: HINSTANCE /// /// Module instance handle that contains the new bitmap resource. Set this member to NULL to instead use a bitmap handle. /// /// public HINSTANCE hInstNew; /// /// Type: UINT_PTR /// /// If hInstNew is NULL, set this member to the bitmap handle of the bitmap with the new button images. Otherwise, /// set it to the resource identifier of the bitmap with the new button images. /// /// public IntPtr nIDNew; /// /// Type: int /// /// Number of button images contained in the new bitmap. The number of new images should be the same as the number of replaced images. /// /// public int nButtons; } /// /// Specifies the location in the registry where the TB_SAVERESTORE message stores and retrieves information about the state /// of a toolbar. /// // typedef struct { HKEY hkr; LPCTSTR pszSubKey; LPCTSTR pszValueName;} TBSAVEPARAMS; https://msdn.microsoft.com/en-us/library/windows/desktop/bb760486(v=vs.85).aspx [PInvokeData("Commctrl.h", MSDNShortId = "bb760486")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct TBSAVEPARAMS { /// /// Type: HKEY /// Handle to the registry key. /// public HKEY hkr; /// /// Type: LPCTSTR /// Subkey name. /// [MarshalAs(UnmanagedType.LPTStr)] public string pszSubKey; /// /// Type: LPCTSTR /// Value name. /// [MarshalAs(UnmanagedType.LPTStr)] public string pszValueName; } } }