L_ILM_EXPORTBITMAPLIST

Sends this message to export a number of bitmaps from the ImageList Control to a Bitmap List.

Parameter

Description

wParam

Ignored, use 0.

lParam

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

Returns

SUCCESS

Function was successful.

<0

An error occurred. Refer to Error Codes.

Comments

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

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, do not try to free the bitmaps of the exported hList list; since it is going to have a reference to the original bitmaps, not a copy of them.

The associated macro is:

L_ImgListExportBitmapList(hWnd, pExportList)

For a complete list of available macros, refer to the Ltlst.h file.

See Also

Elements:

L_ILM_IMPORTBITMAPLIST, L_ILM_GETITEMOPTIONS, L_ILM_SETITEMOPTIONS

Topics:

Using the ImageList Control

 

Image List Control Messages

Example

 L_INT ILM_EXPORTBITMAPLISTExample(HWND hCtrl, L_TCHAR * lpOutputFileName) 
{
   if(IsWindow(hCtrl)) 
   {
      L_INT nRet = SUCCESS;
      // Check if the ImageList control has more than 4 images. 
      if(SendMessage(hCtrl, L_ILM_GETITEMCOUNT, 0, 0L) > 4) 
      {
         LILEXPORTBITMAPLIST ExportList; 
         ZeroMemory(&ExportList, sizeof(LILEXPORTBITMAPLIST)); 

         ExportList.uStructSize     = sizeof(LILEXPORTBITMAPLIST); 
         ExportList.nStartIndex     = 1; // Start from index 1
         ExportList.nItemsToExport  = 2; // Export only 2 images. 

         // Export images
         nRet = (L_INT)SendMessage(hCtrl, L_ILM_EXPORTBITMAPLIST, (WPARAM)0, (LPARAM)(&ExportList)); 

         // Check if the images exported successfully
         if(ExportList.hList) 
         {
            // Save the exported images to a disk-file
            nRet = L_SaveBitmapList(lpOutputFileName,
               ExportList.hList, 
               FILE_GIF, 
               0, 
               2, 
               NULL); 
         }
      }
      return nRet;
   }
   else
      return ERROR_INVALID_PARAMETER;
}