L_AnnLoadMemory
#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) */ |
pHANNOBJECT phObject; |
/* address of the variable to be updated */ |
pLOADFILEOPTION pLoadOptions; |
/* pointer to optional extended load options */ |
Loads an annotation from a file that is stored in memory.
Parameter |
Description |
pMem |
Pointer to the file in memory to be loaded. |
uMemSize |
Size of the file in memory (in bytes). |
phObject |
Address of the variable to be updated with the handle to the container object of the loaded annotations. |
pLoadOptions |
Pointer to optional extended load options. Pass NULL to use the default load options. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
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
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. |
Win32, x64.
See Also
Example
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; /* Save the annotations as a file in memory */ nRet = L_AnnSaveMemory(hContainer, ANNFMT_TIFFTAG, FALSE, &hFileInMemory, &zMemSize, NULL); if(nRet != SUCCESS) return nRet; /* Destroy the temporary container */ nRet = L_AnnDestroy(&TmpContainer, ANNFLAG_RECURSE); if(nRet != SUCCESS) return nRet; /* 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; } else return nRet; /* Clean up */ GlobalUnlock (hFileInMemory); GlobalFree (hFileInMemory); return SUCCESS; }