LAnnContainer::FileInfoMemory

#include "ltwrappr.h"

virtual L_INT LAnnContainer::FileInfoMemory(pMem, uMemSize, pAnnFileInfo, uStructSize)

L_UCHAR * pMem;

pointer to the file location in memory

L_UINT32 uMemSize;

file size, in bytes

pANNFILEINFO pAnnFileInfo;

pointer to an ANNFILEINFO structure

L_UINT uStructSize;

size in bytes, of the structure pointed to by pAnnFileInfo

Loads information about the annotation file located in memory into the specified ANNFILEINFO structure.

Parameter

Description

pMem

Pointer to the location in memory of the image file.

uMemSize

The size, in bytes, of the file referenced by pMem.

pAnnFileInfo

Pointer to the ANNFILEINFO structure to be filled with data from the image file.

uStructSize

Size in bytes, of the structure pointed to by pAnnFileInfo, for versioning. Use sizeof(ANNFILEINFO).

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function can be used to get information about a LEAD annotation file that is stored in memory.

To use this function, do the following:

1.

Assign variables for the memory location of the file located in memory and for its size.

2.

Declare a variable of type ANNFILEINFO.

3.

Fill in the nSize and nOffset fields of the ANNFILEINFO variable. The field nSize should contain the size of the ANNFILEINFO structure in bytes. The nOffset field should contain the byte location of the first byte of the annotation file.

4.

Call the LAnnContainer::FileInfoMemory function, passing the pointer to the file in memory, the address of the ANNFILEINFO variable, and the file size as parameters.

5.

Get the image information from the fields described in ANNFILEINFO structure.

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::FileInfo, LAnnContainer::FileInfoOffset, LAnnContainer::Load, LAnnContainer::LoadOffset, LAnnContainer::LoadMmeory, LAnnContainer::Save, LAnnContainer::SaveOffset, LAnnContainer::SaveMemory, Class Members

Topics:

Annotation Functions: Input and Output

 

Implementing Annotations

Example

L_INT LAnnContainer_FileInfoMemoryExample(LAnnContainer & AnnContainer, L_UINT uFormat) 
{ 
   L_INT nRet; 
   SAVEFILEOPTION SaveFileOption; 
   ANNFILEINFO AnnFileInfo; 
   L_TCHAR szMessage[256]; 
   L_TCHAR * szFormat; 
   HGLOBAL hMem = NULL; 
   L_SIZE_T uMemSize; 
   L_UCHAR * pMem; 
   // Save the annotations as the first page of the file in memory 
   nRet = AnnContainer.SaveMemory(uFormat,FALSE, &hMem, &uMemSize); 
   if(nRet != SUCCESS) 
      return nRet; 
   // Flip and then save as the second page 
   nRet = AnnContainer.Flip(NULL, ANNFLAG_RECURSE); 
   if(nRet != SUCCESS) 
      return nRet; 
   SaveFileOption.uStructSize = sizeof(SAVEFILEOPTION); 
   SaveFileOption.Flags = ESO_INSERTPAGE; 
   SaveFileOption.PageNumber = 2; 
   nRet = AnnContainer.SaveMemory(uFormat, FALSE, &hMem, &uMemSize, &SaveFileOption); 
   if(nRet != SUCCESS) 
      return nRet; 
   // Rotate and then save as the third page 
   nRet = AnnContainer.Rotate(45.0, NULL, ANNFLAG_RECURSE); 
   if(nRet != SUCCESS) 
      return nRet; 
   SaveFileOption.PageNumber = 3; 
   nRet = AnnContainer.SaveMemory(uFormat, FALSE, &hMem, &uMemSize, &SaveFileOption); 
   if(nRet != SUCCESS) 
      return nRet; 
   // Get information about the file in memory 
   AnnFileInfo.uStructSize = sizeof(ANNFILEINFO); 
   AnnFileInfo.nOffset = 0; 
   pMem = (L_UCHAR *) GlobalLock(hMem); 
   nRet =AnnContainer.FileInfoMemory(pMem, (L_UINT)uMemSize, &AnnFileInfo, sizeof(AnnFileInfo)); 
   if(nRet != SUCCESS) 
      return nRet; 
   GlobalUnlock(hMem); 
   switch (AnnFileInfo.uFormat) 
   { 
      case ANNFMT_NATIVE: 
      szFormat = TEXT("ANNFMT_NATIVE"); 
      break; 
      case ANNFMT_WMF: 
      szFormat = TEXT("ANNFMT_WMF"); 
      break; 
      case ANNFMT_ENCODED: 
      szFormat = TEXT("ANNFMT_ENCODED"); 
      break; 
default: 
      szFormat = TEXT("Unknown"); 
      break; 
   } 
   wsprintf(szMessage, TEXT("Version: %d\nFormat: %s\nTotal Pages: %d"), AnnFileInfo.nVersion, szFormat, AnnFileInfo.nTotalPages); 
   MessageBox(NULL, szMessage, TEXT("Information"), MB_OK); 
   // Now, delete the second page 
   nRet = AnnContainer.DeletePageMemory(hMem, &uMemSize, 2); 
   if(nRet != SUCCESS) 
      return nRet; 
   // Again, get information about the file in memory 
   AnnFileInfo.uStructSize = sizeof(ANNFILEINFO); 
   AnnFileInfo.nOffset = 0; 
   pMem = (L_UCHAR *) GlobalLock(hMem); 
   nRet =(L_INT) AnnContainer.FileInfoMemory(pMem,(L_UINT) uMemSize, &AnnFileInfo, sizeof(AnnFileInfo)); 
   if(nRet != SUCCESS) 
      return nRet; 
   GlobalUnlock(hMem); 
   wsprintf(szMessage, TEXT("Version: %d\nFormat: %s\nTotal Pages: %d"), AnnFileInfo.nVersion, 
   szFormat, AnnFileInfo.nTotalPages); 
   MessageBox(NULL, szMessage, TEXT("Information"), MB_OK); 
   GlobalFree(hMem); 
   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