Creating a Toolbar
After initializing the toolbar handle, the toolbar must be created using the L_TBCreate function. The toolbar is created in a regular child window. The user has the option of creating a toolbar "from scratch" and entering the desired buttons, or the user may create a Vector or Paint toolbar, complete with a predefined set of buttons. The following example shows how to create a toolbar:
/* This example will initiate, create a toolbar, set its position and make it visible */
/* Global LEAD toolbar handle */
pTOOLBARHANDLE g_pLeadToolbar ;
L_INT ToolbarTest ( HWND hWnd )
{
/* Initiate the toolbar handle */
L_TBInit ( &g_pLeadToolbar ) ;
/* Check the validity of the handle */
if (SUCCESS == L_TBIsValid ( g_pLeadToolbar ) )
{
POINT pt = { 0, 0 } ;
/* Create the toolbar */
L_TBCreate ( g_pLeadToolbar, hWnd, TEXT("Tools Window"), TOOLBAR_PAINT ) ;
/* Initiate the point will be used to align the toolbar at the top-left of its owner client area */
ClientToScreen ( hWnd, &pt ) ;
/* Set the toolbar position */
L_TBSetPosition ( g_pLeadToolbar, &pt, TOOLBAR_POSITION_TOP | TOOLBAR_POSITION_LEFT ) ;
/* Show the toolbar */
L_TBSetVisible ( g_pLeadToolbar, TRUE ) ;
}
return SUCCESS ;
}
See Also:
Implementing Toolbars- Initializing, Creating and Freeing