uLib  User mode C/C++ extended API library for Win32 programmers.

Module Description

Additional toolbar APIs...

Macros

#define _TBS(s)   (INT_PTR)_T(s)
 
#define TBTN_HEIGHT   22
 
#define TBTN_WIDTH   22
 
#define TBAR_HEIGHT   26
 

Functions

HWND CreateToolbar (HWND hParent, UINT Id, UINT x, UINT y, UINT w, UINT h, UINT cxBtn, UINT cyBtn, HIMAGELIST hImages, LPTBBUTTON Buttons, UINT nButtons, DWORD Style, DWORD ExStyle)
 
HWND CreateStdToolbar (HWND hParent, UINT Id, UINT x, UINT y, UINT w, UINT h, UINT imgType, LPTBBUTTON Buttons, UINT nButtons, DWORD Style, DWORD ExStyle)
 

Macro Definition Documentation

◆ _TBS

#define _TBS (   s)    (INT_PTR)_T(s)

Toolbutton string for the TBBUTTONs used with CreateToolbar().

Definition at line 1638 of file UtilFunc.h.

◆ TBTN_HEIGHT

#define TBTN_HEIGHT   22

Toolbutton height (undocumented CommCtrl32 mandate?)

Definition at line 1668 of file UtilFunc.h.

◆ TBTN_WIDTH

#define TBTN_WIDTH   22

Toolbutton width (undocumented CommCtrl32 mandate?)

Definition at line 1669 of file UtilFunc.h.

◆ TBAR_HEIGHT

#define TBAR_HEIGHT   26

Toolbar height (TBSTYLE_LIST w/o divider)

Definition at line 1670 of file UtilFunc.h.

Function Documentation

◆ CreateToolbar()

HWND CreateToolbar ( HWND  hParent,
UINT  Id,
UINT  x,
UINT  y,
UINT  w,
UINT  h,
UINT  cxBtn,
UINT  cyBtn,
HIMAGELIST  hImages,
LPTBBUTTON  Buttons,
UINT  nButtons,
DWORD  Style,
DWORD  ExStyle 
)

Create a toolbar that uses a specific image list.

Since the original CreateToolbar API ceased to exist,
I brazenly usurp the id to supercede CreateToolbarEx 😉
If it causes you grievance, let me know...

Note: Using CCS_NORESIZE style is crucial for toolbars in rebar bands.
Without it, the toolbar will resize itself to overpaint the whole rebar.
It also makes toolbars less than 26 pixels high possible.
See also CreateStdToolbar(), ImageList_CreateMapped().

Parameters
hParentParent of the toolbar.
IdId of the toolbar.
wToolbar position and width.
hToolbar height (nearly always ignored by CommCtrl32).
cyBtnToolbutton size (nearly always ignored by CommCtrl32).
hImagesHandle of the imagelist to use.
ButtonsArray of TBBUTTON structs defining the buttons.
nButtonsNr of buttons in the array.
StyleToolbar window style (the ususal mess)..
ExStyleAccepts both TBSTYLE_EX_nn and WS_EX_nn.

Definition at line 1604 of file UserUtil.cpp.

◆ CreateStdToolbar()

HWND CreateStdToolbar ( HWND  hParent,
UINT  Id,
UINT  x,
UINT  y,
UINT  w,
UINT  h,
UINT  imgType,
LPTBBUTTON  Buttons,
UINT  nButtons,
DWORD  Style,
DWORD  ExStyle 
)

Create a toolbar that uses a standard image list built into CommCtrl.

Parameters
imgTypeCan be one of IDB_STD_SMALL_COLOR, IDB_VIEW_SMALL_COLOR, or IDB_HIST_SMALL_COLOR.

Note: The LARGE_nn image list variants seems to be dysfunctional..?
See also CreateToolbar() and [MSDN] Toolbar Standard Button Image Index Values.

Definition at line 1640 of file UserUtil.cpp.