#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnLoadMemory(pMem, uMemSize, phObject, pLoadOptions)

L_UCHAR *pMem;

pointer to the file in memory to be loaded

L_SIZE_T uMemSize;

size of the file in memory (in bytes)


address of the variable to be updated


pointer to optional extended load options

Loads an annotation from a file that is stored in memory.




Pointer to the file in memory to be loaded.


Size of the file in memory (in bytes).


Address of the variable to be updated with the handle to the container object of the loaded annotations.


Pointer to optional extended load options. Pass NULL to use the default load options.



The function was successful.

< 1

An error occurred. Refer to Return Codes.


Before calling this function, you must declare a variable of data type HANNOBJECT. Then, pass the address of the variable in the phObject parameter. This function will update the variable with the handle to the container object of the loaded annotations.

You can load annotations from multi-page TIF files using the pLoadOptions parameter.

If you have saved a memory handle to a tag in TIF or WANG format, using L_AnnSaveMemory, you must write the memory handle to the tag into a file using L_SetTag and L_SaveBitmapMemory before you can load it using this function

For more information about loading and pasting automated annotations, refer to Loading and Pasting Automated Annotations.

If this function returns SUCCESS and phObject is updated with NULL, there are no annotation objects to load.

Required DLLs and Libraries


For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.


Win32, x64.

See Also


L_AnnDeletePage, L_AnnDeletePageMemory, L_AnnDeletePageOffset, L_AnnFileInfo, L_AnnFileInfoMemory, L_AnnFileInfoOffset, L_AnnLoad, L_AnnLoadOffset, L_AnnSave, L_AnnSaveMemory, L_AnnSaveOffset, L_AnnSetOptions, L_AnnGetOptions


Annotation Files


Annotation Functions: Input and Output


Implementing Annotations


Implementing an Automated Annotation Program


Implementing a Non-automated Annotation Program


Annotation Features


This example loads temporary annotations from a file, saves the file in memory, then loads the memory-resident file into the globally defined container.

L_INT AnnLoadMemoryExample(HWND hWnd, 
                                          HANNOBJECT hContainer)/* Container annotation object */ 
   HANNOBJECT  TmpContainer;  /* Temporary container for the annotations */ 
   HGLOBAL     hFileInMemory; /* Memory handle */ 
   L_SIZE_T    zMemSize;      /* Size of the data in memory */ 
   L_UCHAR*    pData;         /* Pointer to the data in memory */ 
   L_INT       nRet; 
   HDC         hdc; 
   RECT        rAnnBounds; 
   RECT        rAnnBoundsName; 
   /* Load the initial annotations  */ 
   nRet = L_AnnLoad(MAKE_IMAGE_PATH(TEXT("cannon.ann")), &TmpContainer, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   hFileInMemory = 0; 
   /* Save the annotations as a file in memory */ 
   nRet = L_AnnSaveMemory(TmpContainer, ANNFMT_TIFFTAG, FALSE, &hFileInMemory, &zMemSize, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   L_AnnDestroy(TmpContainer, ANNFLAG_RECURSE); 
   TmpContainer = 0; 
   /* Get the pointer to the memory-resident file */ 
   pData = (L_UCHAR*)GlobalLock (hFileInMemory); 
   /* Load the new file from memory  */ 
   nRet = L_AnnLoadMemory(pData, zMemSize, &TmpContainer, NULL); 
   if (nRet == SUCCESS) 
      nRet = L_AnnInsert(hContainer, TmpContainer, TRUE); 
      if(nRet != SUCCESS) 
         return nRet; 
      hdc = GetDC(hWnd); 
      nRet = L_AnnGetBoundingRect(hContainer, &rAnnBounds, &rAnnBoundsName); 
      if(nRet != SUCCESS) 
         return nRet; 
      nRet = L_AnnDraw(hdc, &rAnnBounds, hContainer); 
      if(nRet != SUCCESS) 
         return nRet; 
      return nRet; 
   /* Clean up */ 
   GlobalUnlock (hFileInMemory); 
   GlobalFree (hFileInMemory); 
   return SUCCESS; 

Help Version 20.0.2018.7.30
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help