LAnnContainer::LoadOffset

#include "ltwrappr.h"

virtual L_INT LAnnContainer::LoadOffset(fd, nOffset, nLength, pLoadFileOption)

L_HFILE fd;

the Windows file handle

L_SSIZE_T nOffset;

position of the first byte to load

L_SIZE_T nLength;

number of bytes of annotation data to read

pLOADFILEOPTION pLoadFileOption;

pointer to a LOADFILEOPTION structure

Loads annotations from a position within a file. This enables you to load an annotation file that is embedded in another file.

Parameter

Description

fd

The Windows file handle of the file to load.

nOffset

The position, from the beginning of the file, of the first byte to load. (The byte count starts at zero.)

nLength

The number of bytes of annotation data to read from the file. If you saved the offset using LAnnContainer::SaveOffset, 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.

pLoadFileOption

Pointer to the LOADFILEOPTION structure to be updated with the current extended values.

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

Win32, x64.

See Also

Functions:

LAnnContainer::DeletePage, LAnnContainer::DeletePageMemory, LAnnContainer::DeletePageOffset, LAnnContainer::FileInfo, LAnnContainer::FileInfoMemory, LAnnContainer::FileInfoOffset, Class Members, LAnnotation::GetOptions, LAnnotation::SetOptions

Topics:

Annotation Functions: Input and Output

 

Implementing Annotations

 

Key Annotation Features

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT LAnnContainer_LoadOffsetExample(LAnnContainer& LeadAContainer) 
{ 
   L_HANDLE OffsetFile; // File handle 
   L_SIZE_T ulSizeWritten; // Variable to be updated with the size written 
   L_INT nRet; 
   DWORD wWrittenBytes; 
   // Create a file ; 
   OffsetFile = CreateFile(MAKE_IMAGE_PATH(TEXT("TOFFSET.ANN")), GENERIC_ALL, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); 
   // Write header information -- 29 characters and a terminator 
   WriteFile(OffsetFile, "This is a 29-character string", 30,&wWrittenBytes,NULL); 
   // Save the file with an offset 
   ulSizeWritten = LeadAContainer.SaveOffset((L_HFILE)&OffsetFile, 30, ANNFMT_NATIVE, FALSE); 
   // Close the file 
   CloseHandle(OffsetFile); 
   /* Loading */ 
   if(ulSizeWritten>0) 
   { 
      // Open the file and get the file handle 
      OffsetFile = CreateFile(MAKE_IMAGE_PATH(TEXT("TOFFSET.ANN")), GENERIC_ALL, 0, NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); 
      // Load the file with a 30-byte offset 
      nRet = LeadAContainer.LoadOffset((L_HFILE)OffsetFile, 30, ulSizeWritten, NULL); 
      if(nRet != SUCCESS) 
         return nRet; 
      // Close the file 
      CloseHandle(OffsetFile); 
   } 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help