L_ILM_GETITEM
Send this message to get the specified item from the ImageList Control.
Parameter |
Description |
wParam |
0-based index of the item to get. |
lParam |
Pointer to LILITEM structure to be filled with the item. |
Returns
SUCCESS |
Function was successful |
< 0 |
An error occurred. Refer to Return Codes. |
Comments
The LILITEM structure pointed to by lParam specifies the information to retrieve and will be filled with the information about the item. The uMask member of the LILITEM structure indicates the attributes of the item to retrieve.
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.
The associated macro is:
L_ImgListGetItem(hWnd, uIndex, pItem)
After this function returns, the LILITEM structure pointed to by lParam will reference the specified item. You can use the pBitmap or pText members of the structure to modify the item. If you modify the bitmap or text pointed to by this structure, you will be directly modifying the item in the ImageList Control. You should not attempt to free the memory pointed to by pBitmap or pText.
For a complete list of available macros, refer to the Ltlst.h file.
See Also
Elements: |
L_ILM_GETITEMCOUNT, L_ILM_SETITEM, L_ILM_GETSELCOUNT, L_ILM_GETSELITEMS |
Topics: |
|
|
Example
L_INT ILM_GETITEMExample(HWND hCtrl) { if(IsWindow(hCtrl)) { LILITEM Item; L_INT nRet; /* get the 3rd item */ ZeroMemory(&Item, sizeof(LILITEM)); Item.uStructSize = sizeof(LILITEM); Item.uBitmapStructSize = sizeof(BITMAPHANDLE); Item.uMask = LILITEM_BITMAP|LILITEM_TEXT; /* retrieve the bitmap & the text */ nRet = (L_INT)SendMessage(hCtrl, L_ILM_GETITEM, 2, (LPARAM)&Item); if(nRet == SUCCESS) { MessageBox(hCtrl, Item.pText, TEXT("Item"), MB_OK); /* flip the image and update the control */ L_FlipBitmap(Item.pBitmap); RedrawWindow(hCtrl, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); } return nRet; } else return ERROR_INVALID_PARAMETER; }