LImageListControl::ExportBitmapList

#include "ltwrappr.h"

L_INT LImageListControl::ExportBitmapList(pExportList)

pLILEXPORTBITMAPLIST pExportList;

/* pointer to structure */

Exports a number of bitmaps from the ImageList Control to a Bitmap List.

Parameter

Description

pExportList

Pointer to the LILEXPORTBITMAPLIST structure that contains the list of bitmaps to be exported.

Returns

SUCCESS

The function was successful.

< 0

An error occurred. Refer to Return Codes.

Comments

You must set the uStructSize member of the LILEXPORTBITMAPLIST structure before using this function.

The list of bitmaps will be exported from the ImageList control into the passed hList starting from nStartIndex to (nStartIndex + nItemsToExport 1).

If you passed NULL into the hList member of the passed LILEXPORTBITMAPLIST structure, this parameter hList will be created internally and is going to contain all the exported bitmaps.

After exporting the list of bitmaps successfully from the ImageList control, dont try to free the bitmaps of the exported list hList, since it is going to have a reference to the original bitmaps--not a copy of them.

Required DLLs and Libraries

LTDISLTFILLTIMG

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:

LImageListControl::ImportBitmapList, LImageListControl::GetItemOptions, LImageListControl::SetItemOptions

Topics:

Using the ImageList Control

 

Raster Image Functions: Displaying Images

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LImageListControl__ExportBitmapListExample(HWND hWnd, LBitmapList& BitmapList, LImageListControl& ImgList) 
{
   UNREFERENCED_PARAMETER(hWnd);
   L_INT nRet ;
   LILEXPORTBITMAPLIST ExportList; 
   // Check if the ImageList control has any images. 
   nRet = ImgList.GetItemCount() ;
   if( nRet > 0) 
   {
      ZeroMemory(&ExportList, sizeof(LILEXPORTBITMAPLIST)); 
      ExportList.uStructSize = sizeof(LILEXPORTBITMAPLIST); 
      ExportList.nStartIndex = 0; // Start from index 1
      ExportList.nItemsToExport = 1; // Export only 2 images. 
      // Export images
      nRet = ImgList.ExportBitmapList(&ExportList) ;
      if(nRet != SUCCESS)
         return nRet;
      // Check if the images exported successfully
      if(ExportList.hList)
      {
         // Save the exported images to a disk-file
         BitmapList.SetHandle(ExportList.hList);
         nRet = BitmapList.Save(MAKE_IMAGE_PATH(TEXT("outputfile.gif")), FILE_GIF, 0, 2, NULL); 
         if(nRet != SUCCESS)
            return nRet;
      }
   }
   else
      return nRet;
   return SUCCESS;
}