#include "ltwrappr.h"
L_INT LToolbar::GetToolbarInfo (pToolbarInfo, uStructSize)
Gets the current toolbar information and copies it to the pToolbarInfo argument.
Pointer to an LTOOLBARINFO structure to be updated with the current toolbar information.
Size in bytes, of the structure pointed to by pToolbarInfo. Use sizeof(LTOOLBARINFO).
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Be sure to free the field contents of the LTOOLBARINFO structure by calling LToolbar::FreeToolbarInfo after it is no longer needed.
Required DLLs and Libraries
This example will create a DigitalPaint toolbar and then gets its information, then changes its button IDs and it will set this information as the new information for the toolbar.
L_INT LToolbar__GetToolbarInfoExample( HWND hWnd, LToolbar* tlb)
{
L_INT nRet;
LTOOLBARINFO ToolbarInfo ;
/* Initiate the toolbar handle */
nRet = tlb->Initialize () ;
if(nRet != SUCCESS)
return nRet;
if ( tlb->IsValid () ) /* check the validity of the toolbar handle */
{
POINT pt = { 0, 0 } ;
/* Create the toolbar */
nRet = tlb->Create (hWnd, TEXT("Tools Window"), TOOLBAR_PAINT ) ;
if(nRet != SUCCESS)
return nRet;
/* Get the toolbar information */
nRet = tlb->GetToolbarInfo (&ToolbarInfo , sizeof(LTOOLBARINFO)) ;
if(nRet != SUCCESS)
return nRet;
/* Change all buttons IDs */
for ( L_UINT i = 0; i < ToolbarInfo.uToolsCount; i ++ )
{
for ( L_UINT j = 0; j < ToolbarInfo.pTools[i].uButtonsCount; j ++ )
{
ToolbarInfo.pTools[i].pButtons[j].uID ++ ;
}
}
/* Get the point that will be used to align the toolbar to
top-left of its owner client area */
::ClientToScreen ( hWnd, &pt ) ;
/* Set the toolbar position */
nRet = tlb->SetPosition (&pt, TOOLBAR_POSITION_TOP | TOOLBAR_POSITION_LEFT ) ;
if(nRet != SUCCESS)
return nRet;
/* Set the new toolbar information */
nRet = tlb->SetToolbarInfo (&ToolbarInfo ) ;
if(nRet != SUCCESS)
return nRet;
/* Free the information that was allocated by L_TBGetToolbarInfo */
nRet = tlb->FreeToolbarInfo (&ToolbarInfo ) ;
if(nRet != SUCCESS)
return nRet;
/* Show the toolbar */
nRet = tlb->SetVisible (TRUE ) ;
if(nRet != SUCCESS)
return nRet;
}
else
{
return FAILURE ;
}
return SUCCESS ;
}