#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnFreeToolBarButtons(pButtons, uButtons)
Frees the memory allocated by L_AnnGetToolBarButtons for the pButtons array.
An array of ANNBUTTON structures that contain information about the buttons in the annotation toolbar.
Number of buttons in the toolbar. (Number of entries in the pButtons
array.)
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Required DLLs and Libraries
Win32, x64.
#define ANNTOOL_USER2 0x0101
#include "windowsx.h"
L_INT AnnFreeToolBarButtonsExample(HWND ToolbarWnd)
{
BITMAPHANDLE LBitmap;
L_UINT uButtons;
pANNBUTTON pButtons;
L_INT nRet;
L_UINT x;
nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), &LBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, 0, NULL);
if(nRet != SUCCESS)
return nRet;
nRet = L_SizeBitmap(&LBitmap, TOOLBARIMAGECX, TOOLBARIMAGECY, 0);
if(nRet != SUCCESS)
return nRet;
/* 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+1;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");
nRet = L_AnnSetToolBarButtons(ToolbarWnd, pButtons, uButtons+1);
if(nRet != SUCCESS)
return nRet;
nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LBitmap, FILE_BMP, 24, 0, NULL);
if(nRet != SUCCESS)
return nRet;
L_FreeBitmap(&LBitmap);
/* free uButtons */
nRet = L_AnnFreeToolBarButtons(pButtons, uButtons);
/* free pButtons */
GlobalFreePtr(pButtons);
ShowWindow(ToolbarWnd, SW_SHOW);
}
else
{
MessageBox(NULL, TEXT("Error getting toolbar buttons."), TEXT(""), MB_OK);
return 0;
}
}
else
{
MessageBox(NULL, TEXT("Not enough memory to allocate pButtons."), TEXT(""), MB_OK);
return 0;
}
}
else
{
MessageBox(NULL, TEXT("Error getting uButtons."), TEXT(""), MB_OK);
return 0;
}
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.