L_GetFilterInfo

#include "l_bitmap.h"

L_LTFIL_API L_INT L_GetFilterInfo(pFilterName, pFilterInfo, uStructSize)

L_WCHAR* 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 L_FreeFilterInfo (pFilterInfo, 1, 0) function to free the allocated memory stored inside the pFilterInfo parameter.

To update the information of the obtained filter, call L_SetFilterInfo function.

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

To obtain the information for all the filters, call the L_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.

Platforms

Windows 2000 / XP/Vista, Windows CE.

See Also

Functions:

L_GetFilterListInfo, L_FreeFilterInfo, L_SetFilterInfo, L_FileInfo

Topics:

Raster Image Functions: Loading Files

 

Raster Image Functions: Getting and Setting File Information

 

Loading and Saving Images

Example

//This example tells L_FileInfo function to check the PCL filter only for files with the usual extensions associated with PCL. The check for PCL and some other vector files is slow. The detection of text or invalid files will be speed up if we tell L_FileInfo to check for these files only if the extension matches the usual extension list for a particular file.

L_INT GetFilterInfoExample(L_VOID)
{
   L_INT nRet;
   FILTERINFO FilterInfo;
   
   // Get the filter information (including the usual extension list)
   nRet =L_GetFilterInfo(TEXT("PCL"), &FilterInfo, sizeof(FILTERINFO));
   if(nRet !=SUCCESS)
      return nRet;
    
   // Remove the FILTERINFO_CHECKEDBYFILEINFO flag. This will make 
   // L_FileInfo 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: L_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 =L_SetFilterInfo(&FilterInfo, 1, 0);
   if(nRet !=SUCCESS)
      return nRet;

   // Free the FilterInfo structure (contents only!) that was allocated with L_GetFilterInfo
  nRet = L_FreeFilterInfo(&FilterInfo, 1, 0);
  if(nRet !=SUCCESS)
     return nRet;

   return SUCCESS;
}