LToolbar::GetButtonInfo

Summary

Gets the information for the specified toolbar button.

Syntax

#include "ltwrappr.h"

L_INT LToolbar::GetButtonInfo (uButtonId, pButtonInfo, uStructSize)

Parameters

L_UINT uButtonId

Identifier that indicates the button for which to get the information.

pLBUTTONINFO pButtonInfo

Pointer to an LBUTTONINFO structure to be updated with the button information.

L_UINT uStructSize

Size, in bytes, of the structure pointed to by pButtonInfo. Use sizeof(LBUTTONINFO).

Returns

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

Comments

To change the information on the specified toolbar button, call this function to get the current information. Change the information in pButtonInfo and then call LToolbar::SetButtonInfo.

When the toolbar button bitmap is no longer needed, you must free it using the Windows API function DeleteObject.

Required DLLs and Libraries

See Also

Functions

Topics

Example

This example will display the tool tip text of each button in a toolbar.

L_INT LToolbar__GetButtonInfoExample( HWND hWnd, LToolbar* tlb) 
 
{ 
   UNREFERENCED_PARAMETER(hWnd); 
 
   L_INT          nRet; 
   LTOOLBARINFO   ToolbarInfo; 
   LBUTTONINFO    ButtonInfo; 
   L_UINT         i, j; 
 
   /* get toolbar info */ 
 
   ToolbarInfo.uStructSize = sizeof( LTOOLBARINFO ); 
 
   nRet = tlb->GetToolbarInfo(&ToolbarInfo, sizeof(LTOOLBARINFO)  ); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* iterate through tools */ 
 
   for( i = 0; i < ToolbarInfo.uToolsCount; i++ ) 
 
   { 
      /* get the text */ 
      for( j = 0; j < ToolbarInfo.pTools[ i ].uButtonsCount; j++ ) 
      { 
         ButtonInfo.uStructSize = sizeof( LBUTTONINFO ); 
 
         nRet = tlb->GetButtonInfo (ToolbarInfo.pTools[ i ].pButtons[ j ].uID, &ButtonInfo, sizeof(LBUTTONINFO)); 
         if(nRet != SUCCESS) 
            return nRet; 
 
         MessageBox(NULL, ButtonInfo.szToolTipText, TEXT(""), MB_OK); 
 
         /* free the bitmap so we don't leak */ 
         DeleteObject( ButtonInfo.hBitmap ); 
      } 
   } 
 
   /* free the info structure */ 
   nRet = tlb->FreeToolbarInfo (&ToolbarInfo); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 

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

LEADTOOLS Toolbar C++ Class Library Help

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