LBaseFile::GetFilterInfo

#include "ltwrappr.h"

static L_INT LBaseFile::GetFilterInfo(pFilterName, pFilterInfo, uStructSize)

L_TCHAR * pFilterName;

/* filter name ID */

pFILTERINFO pFilterInfo;

/* pointer to a FILTERINFO structure */

L_UINT uStructSize;

/* size in bytes, of the structure pointed to by pFilterInfo */

Retrieves the information for a specific filter.

Parameter

Description

pFilterName

Pointer to a character string that contains three characters identification of the filter name. This string cannot be NULL.

pFilterInfo

Pointer to a FILTERINFO structure to be updated with the filter information. This parameter cannot be NULL. The user is responsible to allocate memory for this parameter before pass it to the function.

uStructSize

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

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

To obtain the information of a specific filter, the user should pass the three-character identification (not case-sensitive) of the filter name to the pFilterName parameter of the function. For example, if the user passed "TIF" (or "tif," or "Tif"), then the pFilterInfo parameter will be updated with the information of the LFTIF filter, and the szName member of the pFilterInfo parameter will be "LFTIF1??".

If pFilterName or pFilterInfo parameter passed as NULL, the function will fail and return ERROR_NULL_PTR error code.

If the value of the uStructSize parameter is incorrect, the function will fail and return ERROR_INVALID_STRUCT_SIZE error code.

When a pFilterInfo pointer is no longer needed, call the LBaseFile::FreeFilterInfo(pFilterInfo, 1, 0) function to free the allocated memory stored inside the pFilterInfo parameter.

To update the information of the obtained filter, call LBaseFile::SetFilterInfo function.

To update the filter extension list, be sure to save and restore the original filter list before calling LBaseFile::FreeFilterInfo function.

To obtain the information for all the filters, call the LBaseFile::GetFilterListInfo function.

Required DLLs and Libraries

LTFIL

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LBaseFile::GetFilterListInfo, LBaseFile::FreeFilterInfo, LBaseFile::SetFilterInfo, LFile::GetInfo

Topics:

Raster Image Functions: Loading Files

 

Raster Image Functions: Getting and Setting File Information

 

Loading and Saving Images

Example

L_INT LBaseFile__GetFilterInfoExample()
{
   L_INT nRet;
   FILTERINFO FilterInfo;
   // Get the filter information (including the usual extension list)
   nRet = LBaseFile::GetFilterInfo(TEXT("PCL"), &FilterInfo, sizeof(FILTERINFO));
   if(nRet !=SUCCESS)
      return nRet;
    
   // Remove the FILTERINFO_CHECKEDBYFILEINFO flag. This will make 
   // LBaseFile::GetInfo check this filter only if the extension is in the usual extension list
   FilterInfo.uFlags = FilterInfo.uFlags & ~FILTERINFO_CHECKEDBYFILEINFO;
   // Update the filter information. 
   // Note1: This will affect all the threads!
   // Note2: LBaseFile::GetFilterInfo has set FilterInfo.uStructSize, 
   // So I do not have to manually set it. You should set it if you manually
   // Fill all members of FilterInfo
   nRet =LBaseFile::SetFilterInfo(&FilterInfo, 1, 0);
   if(nRet !=SUCCESS)
      return nRet;
   // Free the FilterInfo structure (contents only!) that was allocated with LBaseFile::GetFilterInfo
  nRet = LBaseFile::FreeFilterInfo(&FilterInfo, 1, 0);
  if(nRet !=SUCCESS)
     return nRet;
}