L_ILM_EXPORTBITMAPLIST

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

Parameters

wParam

Ignored, use 0.

lParam

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

Returns

Value Meaning
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:

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

See Also

Elements

Topics

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); 
            // Remove all of the BITMAPHANDLEs from the HBITMAPLIST because the ImageList owns them. 
            L_UINT uCount = 0; 
            L_GetBitmapListCount(ExportList.hList, &uCount); 
            for(L_INT x = uCount-1; x >= 0; x--) 
            { 
               BITMAPHANDLE Bitmap; 
               L_RemoveBitmapListItem(ExportList.hList, x, &Bitmap); 
            } 
            // Free the HBITMAPLIST 
            L_DestroyBitmapList(ExportList.hList); 
         } 
      } 
      return nRet; 
   } 
   else 
      return ERROR_INVALID_PARAMETER; 
} 
Help Version 21.0.2023.2.15
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

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