LAnnContainer::FileInfo

#include "ltwrappr.h"

virtual L_INT LAnnContainer::FileInfo(pszFile, pAnnFileInfo, uStructSize)

L_TCHAR * pszFile;

input file name to query

pANNFILEINFO pAnnFileInfo;

pointer to a structure

L_UINT uStructSize;

size in bytes, of the structure pointed to by pAnnFileInfo

Gets information about the specified annotation file and fills the specified ANNFILEINFO structure with the information.

Parameter

Description

pszFile

Character string containing the name of the annotation input file.

pAnnFileInfo

Pointer to the ANNFILEINFO structure to be filled. For more information, refer to the ANNFILEINFO structure.

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 find information about a LEAD annotation file.

To use this function, do the following:

1.

Declare a variable with the datatype of ANNFILEINFO.

2.

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.

3.

Declare and assign a character string variable for the annotation file name.

4.

Call the LAnnContainer::FileInfo function, passing the file name and the address of the ANNFILEINFO variable as parameters.

5.

Get the image information from the fields described in the 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::FileInfoMemory, LAnnContainer::FileInfoOffset, LAnnContainer::Load, LAnnContainer::LoadOffset, LAnnContainer::LoadMemory, LAnnContainer::Save, LAnnContainer::SaveOffset, LAnnContainer::SaveMemory

Topics:

Annotation Functions: Input and Output

 

Implementing Annotations

Example

L_INT LAnnContainer_FileInfoExample(LAnnContainer & AnnContainer, L_TCHAR * szFile, L_UINT uFormat) 
{ 
   L_INT nRet; 
 
   SAVEFILEOPTION SaveFileOption; 
 
   ANNFILEINFO AnnFileInfo; 
 
   L_TCHAR szMessage[256]; 
 
   L_TCHAR * szFormat; 
 
 
   // Save the annotations as the first page of the file 
 
   nRet = AnnContainer.Save(szFile, uFormat, FALSE); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // Flip and then save as the second page of the file 
 
   nRet = AnnContainer.Flip(NULL, ANNFLAG_RECURSE); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   SaveFileOption.uStructSize = sizeof(SAVEFILEOPTION); 
 
   SaveFileOption.Flags = ESO_INSERTPAGE; 
 
   SaveFileOption.PageNumber = 2; 
 
   nRet = AnnContainer.Save(szFile, uFormat, FALSE, &SaveFileOption); 
   if(nRet != SUCCESS) 
      return nRet; 
 
 
 
   // Rotate and then save as the third page of the file 
 
   nRet = AnnContainer.Rotate(45.0, NULL, ANNFLAG_RECURSE); 
   if(nRet != SUCCESS) 
      return nRet; 
 
 
 
   SaveFileOption.PageNumber = 3; 
 
   nRet = AnnContainer.Save(szFile, uFormat, FALSE, &SaveFileOption); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // Get information about the file 
 
   AnnFileInfo.uStructSize = sizeof(ANNFILEINFO); 
 
   AnnFileInfo.nOffset = 0; 
 
   nRet = AnnContainer.FileInfo(szFile, &AnnFileInfo, sizeof(AnnFileInfo)); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   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("File Name: %s\nVersion: %d\nFormat: %s\nTotal Pages: %d"),  
            szFile, AnnFileInfo.nVersion, szFormat, AnnFileInfo.nTotalPages); 
 
   MessageBox(NULL, szMessage, TEXT("Information"), MB_OK); 
 
   // Now, delete the second page 
 
   nRet = AnnContainer.DeletePage(szFile, 2); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // Again, get  information about the file 
 
   AnnFileInfo.uStructSize = sizeof(ANNFILEINFO); 
 
   AnnFileInfo.nOffset = 0; 
 
   nRet = AnnContainer.FileInfo(szFile, &AnnFileInfo, sizeof(AnnFileInfo)); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   wsprintf(szMessage, TEXT("File Name: %s\nVersion: %d\nFormat: %s\nTotal Pages: %d"),  
            szFile, AnnFileInfo.nVersion, szFormat, AnnFileInfo.nTotalPages); 
 
   MessageBox(NULL,szMessage, TEXT("Information"), MB_OK); 
 
   return SUCCESS; 
} 
Help Version 20.0.2019.9.23
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help