LFileSettings::GetPreLoadFilters

Summary

Retrieves the current preloaded filters list.

Syntax

#include "ltwrappr.h"

static L_SSIZE_T LFileSettings::GetPreLoadFilters(pszFilters, uSize, pnFixedFilters, pnCachedFilters)

Parameters

L_TCHAR * pszFilters

Pointer to a character string to be updated with the current preloaded filters list.

L_SIZE_T uSize

The size in bytes of the buffer pointed to by pszFilters.

L_INT * pnFixedFilters

Pointer to a variable to be updated with the number of filters that should stay loaded in memory at all times. Pass NULL if it is not required.

L_INT * pnCachedFilters

Pointer to a variable to be updated with the number of filters that should be loaded. Pass NULL if it is not required.

Returns

Value Meaning
>=0 The size in bytes of the preloaded filters list.
< 0 An error occurred. Refer to Return Codes.

Comments

In case the current preloaded filters list should be changed, call this function before calling the LFileSettings::PreloadFilters function.

The preload filters list contains the list of fixed and cached filters. For more information, refer to LFileSettings::PreloadFilters.

To retrieve the preloaded filters list, the user should:

  1. Call the function passing pszFilters as NULL and uSize as 0 to retrieve the size required for the filters list as returned value.

  2. Allocate a buffer of size returned value.

  3. Call the function passing the allocated buffer to the pszFilters and the returned value to uSize to retrieve the filters list.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LFileSettings__GetPreLoadFiltersExample() 
{ 
   L_TCHAR * pszList = NULL; 
   L_INT nFixed; 
   L_INT nCached; 
   L_SIZE_T nRet; 
   LBitmap Bitmap; 
   L_TCHAR buf[80]; 
 
   /* get the original filters list */ 
   nRet = LFileSettings::GetPreLoadFilters(NULL, 0, NULL, NULL); 
   pszList = (L_TCHAR *)malloc(nRet*sizeof(L_TCHAR)); 
   nRet = LFileSettings::GetPreLoadFilters(pszList, nRet, &nFixed, &nCached); 
   ::MessageBox(NULL, pszList, TEXT("TEST"), MB_OK); 
   free(pszList); 
   wsprintf(buf, TEXT("fixed: %ld, cached: %ld"), nFixed, nCached); 
   ::MessageBox(NULL, buf, TEXT("TEST"), MB_OK); 
 
   /* change the preload filters */ 
   /* This example preloads the TGA, PCX and TIF filters */ 
   /* and allows 1 filter to be cached, while always    */ 
   /* keeping 2 loaded.                                 */ 
   LFileSettings::PreLoadFilters( 2, 1, TEXT("TGA,PCX,TIF")); 
 
   /* get the new filters list */ 
   nRet = LFileSettings::GetPreLoadFilters(NULL, 0, NULL, NULL); 
   pszList = (L_TCHAR *)malloc(nRet*sizeof(L_TCHAR)); 
   nRet = LFileSettings::GetPreLoadFilters(pszList, nRet, &nFixed, &nCached); 
   ::MessageBox(NULL, pszList, TEXT("TEST"), MB_OK); 
   free(pszList); 
   wsprintf(buf, TEXT("fixed: %ld, cached: %ld"), nFixed, nCached); 
   ::MessageBox(NULL, buf, TEXT("TEST"), MB_OK); 
 
   /* try to load TGA */ 
   nRet = Bitmap.Load(TEXT("d:\\temp\\test.tga")); 
   if(nRet == SUCCESS) 
      ::MessageBox(NULL, TEXT("TGA loaded"), TEXT("TEST"), MB_OK); 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.