L_AnnFreeToolBarButtons
#include "l_bitmap.h"
L_INT EXT_FUNCTION L_AnnFreeToolBarButtons(pButtons, uButtons)
pANNBUTTON pButtons; |
/* array of buttons to include in the toolbar */ |
L_UINT uButtons; |
/* number of buttons in the toolbar */ |
Frees the memory allocated by L_AnnGetToolBarButtons for the pButtons array. This function is available in the Document/Medical Toolkits.
Parameter |
Description |
pButtons |
An array of ANNBUTTON structures that contain information about the buttons in the annotation toolbar. |
uButtons |
Number of buttons in the toolbar. (Number of entries in the pButtons array.) |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Required DLLs and Libraries
LTANN For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Platforms
Windows 95 / 98 / Me, Windows 2000 / XP.
See Also
Functions: |
|
|
|
|
|
|
|
|
|
|
|
|
|
Topics: |
|
|
|
|
|
|
Example
#define ANNTOOL_USER2 0x0101
#include "windowsx.h"
void TestFunction2(HWND ToolbarWnd)
{
BITMAPHANDLE LBitmap;
L_UINT uButtons;
pANNBUTTON pButtons;
L_INT nRet;
L_UINT x;
L_LoadBitmap(TEXT("ATest.bmp"), &LBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, 0, NULL);
L_SizeBitmap(&LBitmap, TOOLBARIMAGECX, TOOLBARIMAGECY, 0);
/* get the number of buttons in the toolbar */
nRet = L_AnnGetToolBarButtons(ToolbarWnd, NULL, sizeof(ANNBUTTON), &uButtons);
if (nRet == SUCCESS)
{
/* allocate an array big enough to hold the number of existing buttons + 1 */
pButtons = (pANNBUTTON) GlobalAllocPtr(GMEM_MOVEABLE, (uButtons+1)*sizeof(ANNBUTTON));
if (pButtons)
{
/* get the existing buttons */
for(x=0;x<uButtons;x++)
{
pButtons[x].uStructSize = sizeof(ANNBUTTON);
pButtons[x].uBitmapStructSize = sizeof(BITMAPHANDLE);
}
nRet = L_AnnGetToolBarButtons(ToolbarWnd, pButtons, sizeof(ANNBUTTON), &uButtons);
if (nRet == SUCCESS)
{
/* add a new user defined tool button */
pButtons[uButtons].uFlags = 0;
pButtons[uButtons].uTool = ANNTOOL_USER2;
pButtons[uButtons].pBitmapUp = &LBitmap;
pButtons[uButtons].pBitmapDown = pButtons[uButtons].pBitmapUp;
pButtons[uButtons].nToolTipTextID = -1;
pButtons[uButtons].pToolTipText = TEXT("D Tool");
L_AnnSetToolBarButtons(ToolbarWnd, pButtons, uButtons+1);
L_FreeBitmap(&LBitmap);
/* free uButtons /
L_AnnFreeToolBarButtons(pButtons, uButtons);
/* free pButtons */
GlobalFreePtr(pButtons);
ShowWindow(ToolbarWnd, SW_SHOW);
}
else
MessageBox(NULL, TEXT("Error getting toolbar buttons."), TEXT(""), MB_OK);
}
else
MessageBox(NULL, TEXT("Not enough memory to allocate pButtons."), TEXT(""), MB_OK);
}
else
MessageBox(NULL, TEXT("Error getting uButtons."), TEXT(""), MB_OK);
}