L_TBGetToolbarInfo

Summary

Gets the current toolbar information.

Syntax

#include "LtTLB.h"

L_LTTLB_API L_INT L_TBGetToolbarInfo (pToolbar, pToolbarInfo, uStructSize)

Parameters

pTOOLBARHANDLE pToolbar

Pointer to a toolbar handle.

pLTOOLBARINFO pToolbarInfo

Pointer to LTOOLBARINFO structure to be updated with the current toolbar information.

L_UINT uStructSize

Size in bytes, of the structure pointed to by pToolbarInfo, for versioning. Use sizeof(LTOOLBARINFO).

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes

Comments

When the TOOLBARINFO structure is no longer needed, it should be freed using L_TBFreeToolbarInfo.

Required DLLs and Libraries

See Also

Functions

Topics

Example

This example will create a digital paint 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 TBGetToolbarInfoExample(HWND hWnd, pTOOLBARHANDLE * ppLeadToolbar ) 
{ 
   L_INT nRet; 
   LTOOLBARINFO ToolbarInfo ; 
 
   /* Initiate the toolbar handle */ 
   if(*ppLeadToolbar == NULL) 
   { 
      nRet = L_TBInit ( ppLeadToolbar ) ;  
      if(nRet != SUCCESS) 
         return nRet; 
 
      /* Create the toolbar */ 
      nRet = L_TBCreate ( *ppLeadToolbar, hWnd, TEXT("Tools Window"), TOOLBAR_PAINT ) ; 
      if(nRet != SUCCESS) 
         return nRet; 
   } 
 
   nRet = L_TBIsValid ( *ppLeadToolbar ); 
 
   if (SUCCESS == nRet ) /* check the validity of the toolbar handle */ 
   { 
      POINT pt = { 0, 0 } ; 
 
       /* Get the toolbar information */ 
      nRet = L_TBGetToolbarInfo ( *ppLeadToolbar, &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 = L_TBSetPosition ( *ppLeadToolbar, &pt, TOOLBAR_POSITION_TOP | TOOLBAR_POSITION_LEFT ) ; 
      if(nRet != SUCCESS) 
         return nRet; 
 
      /* Set the new toolbar information */ 
      nRet = L_TBSetToolbarInfo ( *ppLeadToolbar, &ToolbarInfo ) ; 
      if(nRet != SUCCESS) 
         return nRet; 
 
      /* Free the information that was allocated by nRet = L_TBGetToolbarInfo */ 
      L_TBFreeToolbarInfo ( *ppLeadToolbar, &ToolbarInfo ) ; 
      if(nRet != SUCCESS) 
         return nRet; 
 
      /* Show the toolbar */ 
      nRet = L_TBSetVisible ( *ppLeadToolbar, TRUE ) ; 
      if(nRet != SUCCESS) 
         return nRet; 
 
      return SUCCESS ; 
   } 
   else 
   { 
      return  nRet; 
   } 
 
} 

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Toolbar C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.