#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnLoadOffset(fd, nOffset, nLength, phObject, pLoadOptions)
Loads annotations from a position within a file. This enables you to load an annotation file that is embedded in another file.
The Windows file handle of the file to load.
The position, from the beginning of the file, of the first byte to load. (The byte count starts at zero.)
The number of bytes of annotation data to read from the file. If you saved the offset using L_AnnSaveOffset, the variable pointed to by puSizeWritten in that function contains the length of data saved. If you do not know the length of the data, pass 0xFFFFFFFF for this parameter.
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.
Value | Meaning |
---|---|
SUCCESS | 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.
For more information about loading and pasting automated annotations, refer to Loading and Pasting Automated Annotations.
Required DLLs and Libraries
Win32, x64.
This example loads an annotation file with a 30-byte offset. For how the test file is created, refer to L_AnnSaveOffset.
#include <Tchar.h>
L_INT AnnLoadOffsetExample(HWND hWnd,
HANNOBJECT hContainer)/* Container annotation object */
{
HANNOBJECT TmpContainer;
HANDLE OffsetFile = NULL; /* File handle */
HANDLE hFile = NULL; /* File handle */
L_INT nRet;
HDC hdc;
RECT rAnnBounds;
RECT rAnnBoundsName;
DWORD dwBytesWritten = 0;
L_SIZE_T SizeWritten = 0;
// Create a file
hFile = CreateFile(MAKE_IMAGE_PATH(TEXT("TEST.ANN")), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
// Write header information -- 29 characters and a terminator
//_write(NewFile, "This is a 29-character string", 30);
WriteFile(hFile, "This is a 29-character string", 30, &dwBytesWritten, NULL);
// Save the file with an offset
nRet = L_AnnSaveOffset( (L_HFILE)hFile, 30, &SizeWritten, hContainer, ANNFMT_XML, FALSE, NULL);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("File saved with offset"), TEXT("Notice"), MB_OK);
else
return nRet;
// Close the file
CloseHandle(hFile);
/* Open the file and get the file handle */
OffsetFile = CreateFile(MAKE_IMAGE_PATH(TEXT("TEST.ANN")), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
/* Load the file with a 30-byte offset */
nRet = L_AnnLoadOffset((L_HFILE) OffsetFile, 30, 0xFFFF, &TmpContainer, NULL);
/* if successfully loaded, view them */
if (nRet == SUCCESS)
{
L_AnnInsert(hContainer, TmpContainer, TRUE);
hdc = GetDC(hWnd);
L_AnnGetBoundingRect(hContainer, &rAnnBounds, &rAnnBoundsName);
L_AnnDraw(hdc, &rAnnBounds, hContainer);
}
else
return nRet;
/* Close the file */
CloseHandle(OffsetFile);
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