L_ILM_SETITEM

Send this message to update the specified item in the ImageList Control.

Parameters

WParam

0-based index of the item to update.

LParam

Pointer to an LILITEM structure that contains new attributes for the item.

Returns

Value Meaning
SUCCESS Function was successful
< 0 An error occurred. Refer to Return Codes.

Comments

The LILITEM structure pointed to by lParam specifies the information to update the specified item with. The uMask member of the LILITEM structure indicates the attributes of the item to update.

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

If you are including the LILITEM_BITMAP flag in the uMask member of the LILITEM structure, you must set the uBitmapStructSize member of the LILITEM structure before using this message.

Note: when you update an item, the image and text (if any) are copied to internal storage. The ImageList Control will free its copy of the image and/or text when the item is deleted. You are responsible for freeing the original data when it is no longer needed by your application.

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_SETITEMExample(HWND hCtrl) 
{ 
   if(IsWindow(hCtrl)) 
   { 
      LILITEM Item; 
      L_TCHAR szText[200]; 
      SYSTEMTIME st; 
      BITMAPHANDLE Bitmap; 
      L_INT nRet; 
 
      /* load new image for the item */ 
      ZeroMemory(&Item, sizeof(LILITEM)); 
      nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("image1.cmp")), &Bitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
      if(nRet == SUCCESS) 
      { 
         Item.uStructSize = sizeof(LILITEM); 
         Item.pBitmap   = &Bitmap; 
         Item.uBitmapStructSize = sizeof(BITMAPHANDLE); 
         Item.pText     = szText; 
         Item.bSelected = TRUE; 
         Item.lData     = 0; 
 
         GetSystemTime(&st); 
         wsprintf(szText, TEXT("%d:%d:%d"),st.wMinute,st.wSecond,st.wMilliseconds); 
         /* update all attributes */ 
         Item.uMask = LILITEM_BITMAP | LILITEM_TEXT | LILITEM_SELECTED | LILITEM_DATA; 
         /* update the 3rd item with the new data */ 
         nRet = (L_INT)SendMessage(hCtrl, L_ILM_SETITEM, 2, (LPARAM)&Item); 
         /* update the control */ 
         RedrawWindow(hCtrl, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); 
          
         L_FreeBitmap(&Bitmap); 
      } 
 
      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.