LFile::ReadFileExtensions

#include "ltwrappr.h"

virtual L_INT LFile::ReadFileExtensions(ppExtensionList, pLoadOptions=NULL)

pEXTENSIONLIST * ppExtensionList;

pointer to a pointer to a structure

pLOADFILEOPTION pLoadOptions;

pointer to optional extended load options

Loads extensions from an Exif file. Please note that not all Exif files have extensions.

Parameter

Description

ppExtensionList

Pointer to a pointer to an EXTENSIONLIST structure to be updated with the extensions read from the specified Exif file.

pLoadOptions

Pointer to optional extended load options. Pass NULL to use the default load options.

Returns

>=0

Length of the comment field.

< 0

An error occurred. Refer to Return Codes.

Comments

Currently, this function works only with Exif files. Exif files can contain extra data stored as "FlashPix extensions". This function can be used to access this extra data. LEADTOOLS refers to this extra data as "extensions".

The LFile::LoadExtensionStampfunction can be used to load a stamp from the extension and LFile::GetExtensionAudio can be used to get embedded audio data.

When the memory allocated by this function is no longer needed, call LFile::FreeExtensions to free the memory.

Required DLLs and Libraries

LTFIL
Exif file format DLLs

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:

LFile::LoadExtensionStamp, LFile::GetExtensionAudio, LFile::FreeExtensions, LFile::ReadStamp, Class Members

Topics:

Raster Image Functions: Getting and Setting File Information

 

Exif File Extensions

 

Implementing Exif Features

Example

#include <stdio.h> 
L_INT LFile__ReadFileExtensionsExample(L_TCHAR * pszFile, L_TCHAR * pszInfoFile) 
{ 
   L_INT nRet; 
   LFile File; 
   pEXTENSIONLIST pExtensionList; 
   L_TCHAR szBuffer[512]; 
   L_TCHAR szText[1024]; 
   L_TCHAR szName[1024]; 
   L_TCHAR szCLSID[64]; 
   HANDLE fd; 
   DWORD dwSizeWrite; 
   File.SetFileName(pszFile); 
   nRet = File.ReadFileExtensions(&pExtensionList); 
   if(nRet != SUCCESS) 
   { 
      MessageBox(NULL, TEXT("Error getting extensions!"), 
      TEXT("Getting Extensions"), MB_OK); 
      return nRet; 
   } 
   // Open the info .txt file 
   fd = CreateFile(pszInfoFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); 
   if(!fd) 
   { 
      MessageBox(NULL, TEXT("Error opening info file!"), 
      TEXT("Getting Extensions"), MB_OK); 
      return FAILURE; 
   } 
   // Do we have a stamp, audio, or both? 
   switch(pExtensionList->uFlags & (EXTENSION_STAMP | EXTENSION_AUDIO)) 
   { 
      case 0: 
      lstrcpy(szBuffer, TEXT("")); break; 
      case EXTENSION_STAMP: 
      lstrcpy(szBuffer, TEXT(", EXTENSION_STAMP")); break; 
      case EXTENSION_AUDIO: 
      lstrcpy(szBuffer, TEXT(", EXTENSION_AUDIO")); break; 
      case EXTENSION_STAMP | EXTENSION_AUDIO: 
      lstrcpy(szBuffer, TEXT(", EXTENSION_STAMP | EXTENSION_AUDIO")); break; 
   } 
   wsprintf(szText, TEXT("Extension count: %d%s\n"), pExtensionList->uCount, szBuffer); 
   WriteFile(fd, szText, 1024, &dwSizeWrite, NULL); 
   for (L_UINT u = 0; u < pExtensionList->uCount; u++) 
   { 
      lstrcpy(szName, pExtensionList->aList[u].pName); 
      if (pExtensionList->aList[u].pClsid) 
         StringFromGUID2((REFGUID) pExtensionList->aList[u].pClsid,(LPWSTR) szCLSID, sizeof(szCLSID)); 
      else 
         lstrcpy(szCLSID, TEXT("NULL")); 
      // Write information about stream 'u' 
      wsprintf(szText, TEXT("[%d]: Name = %s, DataSize = %d, CLSID = %s\n"), u, szName, pExtensionList->aList[u].uDataSize, szCLSID); 
      WriteFile(fd, szText, 1024, &dwSizeWrite, NULL); 
   } 
   CloseHandle(fd); 
   // Run notepad to show the info file 
   wsprintf(szBuffer, TEXT("notepad %s"), pszInfoFile); 
   WinExec((LPCSTR)szBuffer, SW_SHOW); 
   nRet = File.FreeExtensions(pExtensionList); 
   if(nRet != SUCCESS) 
      return nRet; 
   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