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.

See Also

Functions:

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

Topics:

Using the ImageList Control

 

Raster Image Functions: Displaying Images

Example

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 != SUCCESS)
      return nRet;
   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
         nRet = BitmapList.Save(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\outputfile.gif"), FILE_GIF, 0, 2, NULL); 
         if(nRet != SUCCESS)
            return nRet;
      }
   }
   else
      return nRet;
   return SUCCESS;
}