Initializing and Freeing Toolbars
LEADTOOLS accesses toolbars through the TOOLBARHANDLE structure. This structure provides a working area for the toolbar functions. The toolbar handle must be initialized before calling any of the toolbar functions. This is done using the L_TBInit function. The following example shows how to initialize the toolbar handle.
pTOOLBARHANDLE pLeadToolbar ;
/* Initiate the toolbar handle */
L_TBInit ( &pLeadToolbar ) ;
…
A toolbar handle is valid only after L_TBInit and L_TBCreate have been called. The validity of the toolbar should be checked before calling any other toolbar functions. This is done using L_TBIsValid.
When the TOOLBARHANDLE structure is no longer needed, it should be freed using the L_TBFree function. The following example shows how to free a toolbar handle:
if (SUCCESS == L_TBIsValid
( pLeadToolbar ) )
{
L_TBFree ( pLeadToolbar
) ;
return SUCCESS ;
}
else
{
return FAILURE ;
}
Once L_TBFree has been called, the toolbar handle is no longer valid.