LToolbar::GetButtonInfo
#include "ltwrappr.h"
L_INT LToolbar::GetButtonInfo (uButtonId, pButtonInfo, uStructSize)
L_UINT uButtonId; |
/* button Id */ |
pLBUTTONINFO pButtonInfo; |
/* pointer to a structure */ |
L_UINT uStructSize; |
/* size in bytes, of the structure pointed to by pButtonInfo */ |
Gets the information for the specified toolbar button.
Parameter |
Description |
uButtonId |
Identifier that indicates the button for which to get the information. |
pButtonInfo |
Pointer to an LBUTTONINFO structure to be updated with the button information. |
uStructSize |
Size in bytes, of the structure pointed to by pButtonInfo. Use sizeof(LBUTTONINFO). |
Returns
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
LTTLB
For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.
See Also
Functions: |
LToolbar::AddButton, LToolbar::RemoveButton, LToolbar::SetButtonInfo, LToolbar::GetToolbarInfo, LToolbar::SetToolbarInfo, Class Members |
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; }