LFileSettings::PreLoadFilters

#include "ltwrappr.h"

static L_INT LFileSettings::PreLoadFilters(nFixedFilters, nCachedFilters, pszFilters)

L_INT nFixedFilters;

/* number of filters that stay loaded */

L_INT nCachedFilters;

/* number of filters that are loaded, but may be unloaded later */

L_TCHAR * pszFilters;

/* character string containing filters */

Specifies the file format filters to be loaded.

Parameter

Description

nFixedFilters

Number of filters that should stay loaded in memory at all times.

nCachedFilters

Number of filters that should be loaded, but can be unloaded later to make room for other filters.

pszFilters

Character string containing the filters which should be loaded. If pszFilters is NULL, all file filters LEADTOOLS can find will be loaded and LEADTOOLS will determine the order in which the files will be used. pszFilters is in the form xyz, yuv... where XYZ are the 3 letters describing the file filter as in LFxyz13W.DLL or LFxyz15u.dll. For instance, if pszFilter is PCX,TIF,CMP then LFPCX15u.dll will be loaded then LFTIF15u.dll and then LFCMP15u.dll will be loaded. The first nFixedFilters will stay in memory at all times, then the next nCachedFilters will be loaded. However, if other filters will be needed, the cached filters might be unloaded to make room for the new DLLs. It is recommended that the most commonly used DLLs be loaded as fixed to minimize the time required to load/unload file filters. Also, some DLLs may require additional DLLs (like the LFAVI15u.dll or LFFPX15u.dll) so the exact number of DLLs loaded is not necessarily nFixedFilters + nCachedFilters. For more information on available DLLs, refer to Files To Be Included With Your Application.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Some operating systems (like Windows 95) have a limit for the number of DLLs that can be loaded at a time and that limit can be quickly reached, especially if there are several other third party libraries loading DLLs, or if the programming environments themselves load many DLLs. You can use this function to restrict the number of file import/export DLLs that LEADTOOLS will load. Note that the fewer DLLs loaded, the slower the loading/saving of files will be, since there will be more loading/unloading of DLLs.

Please note that LFileSettings::PreLoadFilters has effect only if called before the first time you try to load, save or get information about a file. If you try to load, save or get information about a file without calling LFileSettings::PreLoadFilters first, LEAD loads default filters. For more information, refer to Loading File Filters.

In case the previously loaded DLLs should be changed, call the LFileSettings::GetPreLoadFilters function before calling this 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

Win32, x64.

See Also

Functions:

LFileSettings::IgnoreFilters, LFileSettings::GetPreLoadFilters, LFileSettings::GetIgnoreFilters, Class Members

Topics:

Raster Image Functions: Input/Output File Filters

Example

This example preloads the BMP, PCX, and TIFF filters, and allows 1 filter to be cached, while always keeping 2 loaded.

L_INT LFileSettings__PreLoadFiltersExample()
{
   L_INT nRet;
   nRet = LFileSettings::PreLoadFilters( 2, 1, TEXT("BMP,PCX,TIF"));
   if(nRet != SUCCESS)
      return nRet;
   //...
   return SUCCESS;
}