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";
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
}
///
/// 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")]
public enum TBCDRF
{
/// Version 4.71. Do not draw button edges. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT.
TBCDRF_NOEDGES = 0x00010000,
///
/// 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 4.71. Do not offset the button when pressed. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT.
TBCDRF_NOOFFSET = 0x00040000,
/// 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 draw etched effect for disabled items. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT.
TBCDRF_NOETCHEDEFFECT = 0x00100000,
/// Version 5.00. Blend the button 50 percent with the background. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT.
TBCDRF_BLENDICON = 0x00200000,
/// Version 5.00. Do not draw button background. This occurs when dwDrawStage equals CDDS_ITEMPREPAINT.
TBCDRF_NOBACKGROUND = 0x00400000,
/// Version 6.00, Windows Vista only. Use custom draw colors to render text regardless of visual style.
TBCDRF_USECDCOLORS = 0x00800000,
}
/// 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,
}
#pragma warning disable CS1572 // XML comment has a param tag, but there is no parameter by that name
/// Toolbar Control Messages
[PInvokeData("Commctrl.h")]
public enum ToolbarMessage
{
/// Enables or disables the specified button in a toolbar.
/// Command identifier of the button to enable or disable.
///
/// The LOWORD is a BOOL that indicates whether to enable or disable the specified button. If TRUE, the
/// button is enabled. If FALSE, the button is disabled.
///
/// Returns TRUE if successful, or FALSE otherwise.
TB_CHECKBUTTON = WindowMessage.WM_USER + 2,
/// Presses or releases the specified button in a toolbar.
/// Command identifier of the button to press or release.
///
///
/// 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 TRUE if successful, or FALSE otherwise.
TB_PRESSBUTTON = WindowMessage.WM_USER + 3,
/// Hides or shows the specified button in a toolbar.
/// Command identifier of the button to hide or show.
///
///
/// 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 TRUE if successful, or FALSE otherwise.
TB_HIDEBUTTON = WindowMessage.WM_USER + 4,
/// Sets or clears the indeterminate state of the specified button in a toolbar.
/// Command identifier of the button whose indeterminate state is to be set or cleared.
///
///
/// 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 TRUE if successful, or FALSE otherwise.
TB_INDETERMINATE = WindowMessage.WM_USER + 5,
/// Sets the highlight state of a given button in a toolbar control.
/// Command identifier for a toolbar button.
///
///
/// 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 nonzero if successful, or zero otherwise.
TB_MARKBUTTON = WindowMessage.WM_USER + 6,
/// Determines whether the specified button in a toolbar is enabled.
/// Command identifier of the button.
/// Must be zero.
/// Returns nonzero if the button is enabled, or zero otherwise.
TB_ISBUTTONENABLED = WindowMessage.WM_USER + 9,
/// Determines whether the specified button in a toolbar is checked.
/// Command identifier of the button.
/// Must be zero.
/// Returns nonzero if the button is checked, or zero otherwise.
TB_ISBUTTONCHECKED = WindowMessage.WM_USER + 10,
/// Determines whether the specified button in a toolbar is pressed.
/// Command identifier of the button.
/// Must be zero.
/// Returns nonzero if the button is pressed, or zero otherwise.
TB_ISBUTTONPRESSED = WindowMessage.WM_USER + 11,
/// Determines whether the specified button in a toolbar is hidden.
/// Command identifier of the button.
/// Must be zero.
/// Returns nonzero if the button is hidden, or zero otherwise.
TB_ISBUTTONHIDDEN = WindowMessage.WM_USER + 12,
/// Determines whether the specified button in a toolbar is indeterminate.
/// Command identifier of the button.
/// Must be zero.
/// Returns nonzero if the button is indeterminate, or zero otherwise.
TB_ISBUTTONINDETERMINATE = WindowMessage.WM_USER + 13,
/// Checks the highlight state of a toolbar button.
/// Command identifier for a toolbar button.
/// Must be zero.
/// Returns nonzero if the button is highlighted, or zero otherwise.
TB_ISBUTTONHIGHLIGHTED = WindowMessage.WM_USER + 14,
/// Sets the state for the specified button in a toolbar.
/// Command identifier of the button.
///
/// The LOWORD is a combination of values listed in Toolbar Button States. The HIWORD must be zero.
///
/// Returns TRUE if successful, or FALSE otherwise.
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.
///
/// Command identifier of the button for which to retrieve information.
/// Must be zero.
///
/// 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.
///
TB_GETSTATE = WindowMessage.WM_USER + 18,
/// Adds one or more images to the list of button images available for a toolbar.
///
/// Number of button images in the bitmap. If lParam specifies a system-defined bitmap, this parameter is ignored.
///
///
/// 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 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.
///
TB_ADDBITMAP = WindowMessage.WM_USER + 19,
/// Adds one or more buttons to a toolbar.
/// Number of buttons to add.
///
/// 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 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.
///
TB_ADDBUTTONSA = WindowMessage.WM_USER + 20,
/// Inserts a button in a toolbar.
/// Zero-based index of a button. The message inserts the new button to the left of this button.
/// Pointer to a TBBUTTON structure containing information about the button to insert.
/// Returns TRUE if successful, or FALSE otherwise.
TB_INSERTBUTTONA = WindowMessage.WM_USER + 21,
/// Deletes a button from the toolbar.
/// Zero-based index of the button to delete.
/// Must be zero.
/// Returns TRUE if successful, or FALSE otherwise.
TB_DELETEBUTTON = WindowMessage.WM_USER + 22,
/// Retrieves information about the specified button in a toolbar.
/// Zero-based index of the button for which to retrieve information.
/// Pointer to the TBBUTTON structure that receives the button information.
/// Returns TRUE if successful, or FALSE otherwise.
TB_GETBUTTON = WindowMessage.WM_USER + 23,
/// Retrieves a count of the buttons currently in the toolbar.
/// Must be zero.
/// Must be zero.
/// Returns the count of the buttons.
TB_BUTTONCOUNT = WindowMessage.WM_USER + 24,
/// Retrieves the zero-based index for the button associated with the specified command identifier.
/// Command identifier associated with the button.
/// Must be zero.
/// Returns the zero-based index for the button or -1 if the specified command identifier is invalid.
TB_COMMANDTOINDEX = WindowMessage.WM_USER + 25,
/// Send this message to initiate saving or restoring a toolbar state.
///
/// Save or restore flag. If this parameter is TRUE, the information is saved. If it is FALSE, the information is restored.
///
///
/// Pointer to a TBSAVEPARAMS structure that specifies the registry key, subkey, and value name for the toolbar state information.
///
/// 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.
///
///
TB_SAVERESTOREA = WindowMessage.WM_USER + 26,
/// Send this message to initiate saving or restoring a toolbar state.
///
/// Save or restore flag. If this parameter is TRUE, the information is saved. If it is FALSE, the information is restored.
///
///
/// Pointer to a TBSAVEPARAMS structure that specifies the registry key, subkey, and value name for the toolbar state information.
///
/// 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.
///
///
TB_SAVERESTOREW = WindowMessage.WM_USER + 76,
/// Displays the Customize Toolbar dialog box.
/// Must be zero.
/// Must be zero.
/// No return value.
///
TB_CUSTOMIZE = WindowMessage.WM_USER + 27,
/// Adds a new string to the toolbar's string pool.
///
/// 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.
///
/// Resource identifier for the string resource, or a pointer to a TCHAR array. See Remarks.
/// 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.
///
///
TB_ADDSTRINGA = WindowMessage.WM_USER + 28,
/// Adds a new string to the toolbar's string pool.
///
/// 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.
///
/// Resource identifier for the string resource, or a pointer to a TCHAR array. See Remarks.
/// 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.
///
///
TB_ADDSTRINGW = WindowMessage.WM_USER + 77,
/// Retrieves the bounding rectangle of a button in a toolbar.
/// Zero-based index of the button for which to retrieve information.
/// Pointer to a RECT structure that receives the client coordinates of the bounding rectangle.
/// 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.
///
TB_GETITEMRECT = WindowMessage.WM_USER + 29,
/// Specifies the size of the TBBUTTON structure.
/// Size, in bytes, of the TBBUTTON structure.
/// Must be zero.
/// 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.
///
///
TB_BUTTONSTRUCTSIZE = WindowMessage.WM_USER + 30,
/// Sets the size of buttons on a toolbar.
/// Must be zero.
///
/// The LOWORD specifies the width, in pixels, of the buttons. The HIWORD specifies the height, in pixels, of the buttons.
///
/// 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.
///
///
TB_SETBUTTONSIZE = WindowMessage.WM_USER + 31,
/// Sets the size of the bitmapped images to be added to a toolbar.
/// Must be zero.
///
/// The LOWORD specifies the width, in pixels, of the bitmapped images. The HIWORD specifies the height, in
/// pixels, of the bitmapped images.
///
/// 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.
///
TB_SETBITMAPSIZE = WindowMessage.WM_USER + 32,
/// Causes a toolbar to be resized.
/// Must be zero.
/// Must be zero.
/// 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.
///
TB_AUTOSIZE = WindowMessage.WM_USER + 33,
/// Retrieves the handle to the tooltip control, if any, associated with the toolbar.
/// Must be zero.
/// Must be zero.
/// Returns the handle to the tooltip control, or NULL if the toolbar has no associated tooltip.
TB_GETTOOLTIPS = WindowMessage.WM_USER + 35,
/// Associates a tooltip control with a toolbar.
/// Handle to the tooltip control.
/// Must be zero.
/// No return value.
///
/// Any buttons added to a toolbar before sending the TB_SETTOOLTIPS message will not be registered with the tooltip control.
///
TB_SETTOOLTIPS = WindowMessage.WM_USER + 36,
/// Sets the window to which the toolbar control sends notification messages.
/// Handle to the window to receive notification messages.
/// Must be zero.
///
/// 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.
///
TB_SETPARENT = WindowMessage.WM_USER + 37,
/// Sets the number of rows of buttons in a toolbar.
///
///
/// 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.
///
///
///
/// Pointer to a RECT structure that receives the bounding rectangle of the toolbar after the rows are set.
///
/// 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.
///
TB_SETROWS = WindowMessage.WM_USER + 39,
/// Retrieves the number of rows of buttons in a toolbar with the TBSTYLE_WRAPABLE style.
/// Must be zero.
/// Must be zero.
/// Returns the number of rows.
TB_GETROWS = WindowMessage.WM_USER + 40,
/// Retrieves the flags that describe the type of bitmap to be used.
/// Must be zero.
/// Must be zero.
///
/// 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.
///
TB_GETBITMAPFLAGS = WindowMessage.WM_USER + 41,
/// Sets the command identifier of a toolbar button.
/// Zero-based index of the button whose command identifier is to be set.
/// Command identifier.
/// Returns TRUE if successful, or FALSE otherwise.
TB_SETCMDID = WindowMessage.WM_USER + 42,
/// Changes the bitmap for a button in a toolbar.
/// Command identifier of the button that is to receive a new bitmap.
///
///
/// 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 TRUE if successful, or FALSE otherwise.
TB_CHANGEBITMAP = WindowMessage.WM_USER + 43,
/// Retrieves the index of the bitmap associated with a button in a toolbar.
/// Command identifier of the button whose bitmap index is to be retrieved.
/// Must be zero.
/// Returns the index of the bitmap if successful, or zero otherwise.
TB_GETBITMAP = WindowMessage.WM_USER + 44,
/// Retrieves the display text of a button on a toolbar.
/// Command identifier of the button whose text is to be retrieved.
/// Pointer to a buffer that receives the button text.
///
/// 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.
///
TB_GETBUTTONTEXTA = WindowMessage.WM_USER + 45,
/// Retrieves the display text of a button on a toolbar.
/// Command identifier of the button whose text is to be retrieved.
/// Pointer to a buffer that receives the button text.
///
/// 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.
///
TB_GETBUTTONTEXTW = WindowMessage.WM_USER + 75,
/// Replaces an existing bitmap with a new bitmap.
/// Must be zero.
///
/// Pointer to a TBREPLACEBITMAP structure that contains the information of the bitmap to be replaced and the new bitmap.
///
/// Returns nonzero if successful, or zero otherwise.
TB_REPLACEBITMAP = WindowMessage.WM_USER + 46,
/// Sets the indentation for the first button in a toolbar control.
/// Value specifying the indentation, in pixels.
/// Must be zero.
/// Returns nonzero if successful, or zero otherwise.
TB_SETINDENT = WindowMessage.WM_USER + 47,
/// Sets the image list that the toolbar uses to display buttons that are in their default state.
///
/// 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.
///
///
/// Handle to the image list to set. If this parameter is NULL, no images are displayed in the buttons.
///
///
/// 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.
///
///
///
/// 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);
///
///
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.
///
/// Must be zero.
/// Must be zero.
/// Returns the handle to the image list, or NULL if no image list is set.
TB_GETIMAGELIST = WindowMessage.WM_USER + 49,
/// Loads system-defined button images into a toolbar control's image list.
///
/// 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.
///
///
///
/// Instance handle. This parameter must be set to HINST_COMMCTRL.
///
/// 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.
///
TB_LOADIMAGES = WindowMessage.WM_USER + 50,
/// Retrieves the bounding rectangle for a specified toolbar button.
/// Command identifier of the button.
/// Pointer to a RECT structure that will receive the bounding rectangle information.
/// 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.
///
TB_GETRECT = WindowMessage.WM_USER + 51,
/// Sets the image list that the toolbar control will use to display hot buttons.
/// Must be zero.
/// Handle to the image list that will be set.
///
/// 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.
///
TB_SETHOTIMAGELIST = WindowMessage.WM_USER + 52,
/// Retrieves the image list that a toolbar control uses to display hot buttons.
/// Must be zero.
/// Must be zero.
///
/// 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.
///
TB_GETHOTIMAGELIST = WindowMessage.WM_USER + 53,
/// Sets the image list that the toolbar control will use to display disabled buttons.
/// Must be zero.
/// Handle to the image list that will be set.
///
/// Returns the handle to the image list previously used to display disabled buttons, or NULL if no image list was
/// previously set.
///
TB_SETDISABLEDIMAGELIST = WindowMessage.WM_USER + 54,
/// Retrieves the image list that a toolbar control uses to display inactive buttons.
/// Must be zero.
/// Must be zero.
/// Returns the handle to the inactive image list, or NULL if no inactive image list is set.
TB_GETDISABLEDIMAGELIST = WindowMessage.WM_USER + 55,
/// Sets the style for a toolbar control.
/// Must be zero.
///
/// Value specifying the styles to be set for the control. This value can be a combination of toolbar control styles.
///
/// No return value.
TB_SETSTYLE = WindowMessage.WM_USER + 56,
/// Retrieves the styles currently in use for a toolbar control.
/// Must be zero.
/// Must be zero.
/// Returns a DWORD value that is a combination of toolbar control styles.
TB_GETSTYLE = WindowMessage.WM_USER + 57,
/// Retrieves the current width and height of toolbar buttons, in pixels.
/// Must be zero.
/// Must be zero.
/// Returns a DWORD value that contains the width and height values in the low word and high word, respectively.
TB_GETBUTTONSIZE = WindowMessage.WM_USER + 58,
/// Sets the minimum and maximum button widths in the toolbar control.
/// Must be zero.
///
///
/// 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 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.
///
TB_SETBUTTONWIDTH = WindowMessage.WM_USER + 59,
/// Sets the maximum number of text rows displayed on a toolbar button.
/// Maximum number of rows of text that can be displayed.
/// Must be zero.
/// 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.
///
TB_SETMAXTEXTROWS = WindowMessage.WM_USER + 60,
/// Retrieves the maximum number of text rows that can be displayed on a toolbar button.
/// Must be zero.
/// Must be zero.
/// Returns an INT value representing the maximum number of text rows that the control will display for a button.
TB_GETTEXTROWS = WindowMessage.WM_USER + 61,
/// Retrieves the IDropTarget for a toolbar control.
/// Identifier of the interface being requested. This value must point to IID_IDropTarget.
///
/// Address that receives the interface pointer. If an error occurs, a NULL pointer is placed in this address.
///
/// 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.
TB_GETOBJECT = WindowMessage.WM_USER + 62,
/// Retrieves extended information for a button in a toolbar.
/// Command identifier of the button.
///
/// 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 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.
///
TB_GETBUTTONINFOW = WindowMessage.WM_USER + 63,
/// Sets the information for an existing button in a toolbar.
/// Button identifier.
///
/// 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 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.
///
TB_SETBUTTONINFOW = WindowMessage.WM_USER + 64,
/// Retrieves extended information for a button in a toolbar.
/// Command identifier of the button.
///
/// 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 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.
///
TB_GETBUTTONINFOA = WindowMessage.WM_USER + 65,
/// Sets the information for an existing button in a toolbar.
/// Button identifier.
///
/// 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 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.
///
TB_SETBUTTONINFOA = WindowMessage.WM_USER + 66,
/// Inserts a button in a toolbar.
/// Zero-based index of a button. The message inserts the new button to the left of this button.
/// Pointer to a TBBUTTON structure containing information about the button to insert.
/// Returns TRUE if successful, or FALSE otherwise.
TB_INSERTBUTTONW = WindowMessage.WM_USER + 67,
/// Adds one or more buttons to a toolbar.
/// Number of buttons to add.
///
/// 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 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.
///
TB_ADDBUTTONSW = WindowMessage.WM_USER + 68,
/// Determines where a point lies in a toolbar control.
/// Must be zero.
///
/// 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 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.
///
TB_HITTEST = WindowMessage.WM_USER + 69,
/// Sets the text drawing flags for the toolbar.
///
/// One or more of the DT_ flags, specified in DrawText, that indicate which bits in lParam will be used when drawing the text.
///
///
/// 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 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.
///
TB_SETDRAWTEXTFLAGS = WindowMessage.WM_USER + 70,
/// Retrieves the index of the hot item in a toolbar.
/// Must be zero.
/// Must be zero.
///
/// 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.
///
TB_GETHOTITEM = WindowMessage.WM_USER + 71,
/// Sets the hot item in a toolbar.
/// Index of the item that will be made hot. If this value is -1, none of the items will be hot.
/// Must be zero.
/// 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.
TB_SETHOTITEM = WindowMessage.WM_USER + 72,
/// Sets the anchor highlight setting for a toolbar.
///
/// 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.
///
/// Must be zero.
///
/// 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.
///
TB_SETANCHORHIGHLIGHT = WindowMessage.WM_USER + 73,
/// Retrieves the anchor highlight setting for a toolbar.
/// Must be zero.
/// Must be zero.
///
/// 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.
///
TB_GETANCHORHIGHLIGHT = WindowMessage.WM_USER + 74,
/// Determines the ID of the button that corresponds to the specified accelerator character.
/// The accelerator character.
///
/// 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 a nonzero value if one of the buttons has wParam as its accelerator character, or zero otherwise.
TB_MAPACCELERATORA = WindowMessage.WM_USER + 78,
/// Retrieves the current insertion mark for the toolbar.
/// Must be zero.
/// Pointer to a TBINSERTMARK structure that receives the insertion mark.
/// Always returns TRUE.
TB_GETINSERTMARK = WindowMessage.WM_USER + 79,
/// Sets the current insertion mark for the toolbar.
/// Must be zero.
/// Pointer to a TBINSERTMARK structure that contains the insertion mark.
/// The return value for this message is not used.
TB_SETINSERTMARK = WindowMessage.WM_USER + 80,
/// Retrieves the insertion mark information for a point in a toolbar.
///
/// Pointer to a POINT structure that contains the hit test coordinates, relative to the client area of the toolbar.
///
/// Pointer to a TBINSERTMARK structure that receives the insertion mark information.
/// Returns nonzero if the point is an insertion mark, or zero otherwise.
TB_INSERTMARKHITTEST = WindowMessage.WM_USER + 81,
/// Moves a button from one index to another.
/// Zero-based index of the button to be moved.
/// Zero-based index where the button will be moved.
/// Returns nonzero if successful, or zero otherwise.
TB_MOVEBUTTON = WindowMessage.WM_USER + 82,
/// Retrieves the total size of all of the visible buttons and separators in the toolbar.
/// Must be zero.
/// Pointer to a SIZE structure that receives the size of the items.
/// Returns nonzero if successful, or zero otherwise.
TB_GETMAXSIZE = WindowMessage.WM_USER + 83,
/// Sets the extended styles for a toolbar control.
/// Must be zero.
/// Value specifying the new extended styles. This parameter can be a combination of extended styles.
///
/// Returns a DWORD that represents the previous extended styles. This value can be a combination of extended styles.
///
TB_SETEXTENDEDSTYLE = WindowMessage.WM_USER + 84,
/// Retrieves the extended styles for a toolbar control.
/// Must be zero.
/// Must be zero.
///
/// Returns a DWORD that represents the styles currently in use for the toolbar control. This value can be a combination
/// of extended styles.
///
TB_GETEXTENDEDSTYLE = WindowMessage.WM_USER + 85,
/// Retrieves the padding for a toolbar control.
/// Must be zero.
/// Must be zero.
///
/// Returns a DWORD value that contains the horizontal padding in the low word and the vertical padding in the high word,
/// in pixels.
///
TB_GETPADDING = WindowMessage.WM_USER + 86,
/// Sets the padding for a toolbar control.
/// Must be zero.
///
/// The LOWORD specifies the horizontal padding, in pixels. The HIWORD specifies the vertical padding, in pixels.
///
///
/// 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.
///
TB_SETPADDING = WindowMessage.WM_USER + 87,
/// Sets the color used to draw the insertion mark for the toolbar.
/// Must be zero.
/// COLORREF value that contains the new insertion mark color.
/// Returns a COLORREF value that contains the previous insertion mark color.
TB_SETINSERTMARKCOLOR = WindowMessage.WM_USER + 88,
/// Retrieves the color used to draw the insertion mark for the toolbar.
/// Must be zero.
/// Must be zero.
/// Returns a COLORREF value that contains the current insertion mark color.
TB_GETINSERTMARKCOLOR = WindowMessage.WM_USER + 89,
/// Determines the ID of the button that corresponds to the specified accelerator character.
/// The accelerator character.
///
/// 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 a nonzero value if one of the buttons has wParam as its accelerator character, or zero otherwise.
TB_MAPACCELERATORW = WindowMessage.WM_USER + 90,
/// Retrieves a string from a toolbar's string pool.
///
/// The LOWORD specifies the length of the lParam buffer, in bytes. The HIWORD specifies the index of the string.
///
/// Pointer to a buffer used to return the string.
/// 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.
///
TB_GETSTRINGW = WindowMessage.WM_USER + 91,
/// Retrieves a string from a toolbar's string pool.
///
/// The LOWORD specifies the length of the lParam buffer, in bytes. The HIWORD specifies the index of the string.
///
/// Pointer to a buffer used to return the string.
/// 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.
///
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.
///
/// Must be zero.
///
/// Pointer to a SIZE structure whose cy member contains the bounding height. The cx member (the width) is ignored.
///
/// 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.
///
TB_SETBOUNDINGSIZE = WindowMessage.WM_USER + 93,
/// Sets the hot item in a toolbar.
/// Index of the item that will be made hot. If this value is -1, none of the items will be hot.
///
/// A combination of HICF\_xxx flags. See
/// **NMTBHOTITEM**
/// .
///
/// 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.
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.
///
/// A WCHAR representing the input accelerator character to test.
/// Pointer to an int that receives the number of buttons that have the accelerator character.
/// 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.
///
TB_HASACCELERATOR = WindowMessage.WM_USER + 95,
/// Sets the distance between the toolbar buttons on a specific toolbar.
/// The gap, in pixels, between buttons on the toolbar.
/// Ignored.
/// 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.
///
TB_SETLISTGAP = WindowMessage.WM_USER + 96,
/// Gets the number of image lists associated with the toolbar.
/// Must be zero.
/// Must be zero.
/// Returns the number of image lists.
TB_GETIMAGELISTCOUNT = WindowMessage.WM_USER + 98,
/// Gets the ideal size of the toolbar.
///
/// 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.
///
///
/// 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 TRUE if successful, or FALSE otherwise.
TB_GETIDEALSIZE = WindowMessage.WM_USER + 99,
/// Retrieves the metrics of a toolbar control.
/// Must be zero.
/// Pointer to a TBMETRICS structure that receives the toolbar metrics.
/// The return value is not used.
///
TB_GETMETRICS = WindowMessage.WM_USER + 101,
/// Sets the metrics of a toolbar control.
/// Must be zero.
/// TBMETRICS structure that contains the toolbar metrics to set.
/// The return value is not used.
///
TB_SETMETRICS = WindowMessage.WM_USER + 102,
/// Gets the bounding rectangle of the dropdown window for a toolbar item with style BTNS_DROPDOWN.
/// The zero-based index of the toolbar control item for which to retrieve the bounding rectangle.
///
/// 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.
///
///
/// Always returns nonzero.
/// The item must have the BTNS_DROPDOWN style.
TB_GETITEMDROPDOWNRECT = WindowMessage.WM_USER + 103,
/// Sets the image list that the toolbar uses to display buttons that are in a pressed state.
///
/// 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.
///
///
/// Handle to the image list to set. If this parameter is NULL, no images are displayed in the buttons.
///
///
/// 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.
///
///
///
/// 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);
///
///
TB_SETPRESSEDIMAGELIST = WindowMessage.WM_USER + 104,
/// Gets the image list that a toolbar control uses to display buttons in a pressed state.
/// Must be zero.
/// Must be zero.
/// Returns the handle to the image list, or NULL if no image list is set.
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;
///
///
///
/// 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 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.
///
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;
///
///
///
/// Pointer to an NMTOOLBAR structure. The iItem member contains the command identifier of the button being dragged.
///
/// No return value.
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;
///
///
///
/// Pointer to an NMTOOLBAR structure. The iItem member contains the command identifier of the button being dragged.
///
/// No return value.
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;
///
///
/// Pointer to an NMHDR structure that contains information about the notification code.
/// No return value.
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;
///
///
/// Pointer to an NMHDR structure that contains information about the notification code.
/// No return value.
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;
///
///
/// Pointer to an NMHDR structure that contains information about the notification code.
/// Return TBNRF_ENDCUSTOMIZE to close the Customize Toolbar dialog box. All other return values are ignored.
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;
///
///
///
/// Pointer to an NMTOOLBAR structure. The iItem member contains the zero-based index of the button to be inserted.
///
///
/// Return TRUE to allow a button to be inserted in front of the given button, or FALSE to prevent the button from
/// being inserted.
///
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;
///
///
///
/// Pointer to an NMTOOLBAR structure. The iItem member contains the zero-based index of the button to be deleted.
///
/// Returns TRUE to allow the button to be deleted, or FALSE to prevent the button from being deleted.
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;
///
///
/// Pointer to an NMHDR structure that contains information about the notification code.
/// No return value.
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;
///
///
/// Pointer to an NMHDR structure that contains information about the notification code.
/// No return value.
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;
///
///
///
/// 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 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.
///
///
///
///
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;
///
///
///
/// 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.
///
/// 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.
///
///
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;
///
///
/// Pointer to an NMTBHOTITEM structure that contains information about this notification code.
/// Return zero to allow the item to be highlighted, or nonzero to prevent the item from being highlighted.
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;
///
///
///
/// 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.
///
/// 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.
///
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;
///
///
///
/// 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.
///
/// The return value is ignored.
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;
///
///
///
/// 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.
///
/// The return value is ignored by the control.
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;
///
///
///
/// 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.
///
/// The return value is ignored by the control.
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;
///
///
///
/// Pointer to an NMTBGETINFOTIP structure that contains item information and receives infotip information.
///
/// 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.
///
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;
///
///
///
/// Pointer to an NMTBGETINFOTIP structure that contains item information and receives infotip information.
///
/// 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.
///
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;
///
///
///
/// 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 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.
///
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;
///
///
/// Pointer to an NMTBRESTORE structure.
///
/// 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.
///
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;
///
///
/// Pointer to an NMTBSAVE structure.
/// 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.
///
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;
///
///
/// Pointer to the toolbar's NMHDR structure.
/// Returns TBNRF_HIDEHELP to suppress the Help button.
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;
///
///
///
/// 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.
///
/// 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;
///
///
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;
///
///
///
/// A pointer to a structure that provides an accelerator and that receives a value specifying whether multiple toolbars respond
/// to the same character.
///
/// 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;
///
///
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;
///
///
///
/// 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.
///
/// 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;
///
///
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;
///
///
/// A pointer to an NMTBHOTITEM structure that specifies which item is being dragged over.
/// FALSE if the toolbar should send a TB_MARKBUTTON message; otherwise TRUE.
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;
///
///
///
/// 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.
///
/// TRUE if NMCHAR.dwItemNext is set to a value.
TBN_MAPACCELERATOR = TBN_FIRST - 28,
}
#pragma warning restore CS1572 // XML comment has a param tag, but there is no parameter by that name
/// 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,
}
/// 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,
}
/// 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 uint 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.
///
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.
///
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 uint 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.
///
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 uint 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 byte 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 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 string 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 uint 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 uint 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.
///
public string pszSubKey;
///
/// Type: LPCTSTR
/// Value name.
///
public string pszValueName;
}
}
}