Send this message to get the currently selected items in the ImageList Control.
Ignored, use 0.
Pointer to a caller-allocated array of LILITEM structures to be filled with the selected items.
Value | Meaning |
---|---|
>=0 | The number of items currently selected and pointed to by lParam |
< 0 | An error occurred. Refer to Return Codes. |
The return value is the number of items pointed to by lParam.
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.
You must allocate the array to be large enough to hold the selected items and free the memory when it is no longer needed by your application.
If you pass NULL for lParam, the message will simply return the current number of selected items.
The LILITEM structure for each selected item will contain all attributes for the item. The lIndex member of the structure will contain the 0-based index of the item.
The associated macro is:
For a complete list of available macros, refer to the Ltlst.h file.
L_INT ILM_GETSELITEMSExample(HWND hCtrl)
{
if(IsWindow(hCtrl))
{
L_INT nRet;
L_TCHAR szText[200];
L_TCHAR szMsg[200];
pLILITEM pItems=NULL;
pLILITEM pTemp=NULL;
L_INT32 x;
/* Get selected item count */
nRet = (L_INT)SendMessage(hCtrl, L_ILM_GETSELITEMS, 0, 0L);
if(nRet > 0)
{
/* allocate the storage */
pItems = (pLILITEM)malloc(nRet * sizeof(LILITEM));
ZeroMemory(pItems, nRet * sizeof(LILITEM));
pTemp = pItems;
for(x=0; x<nRet; x++)
{
pTemp[x].uStructSize = sizeof(LILITEM);
pTemp[x].uBitmapStructSize = sizeof(BITMAPHANDLE);
}
/* Get selected items */
nRet = (L_INT)SendMessage(hCtrl, L_ILM_GETSELITEMS, 0, (LPARAM)pItems);
pTemp = pItems;
lstrcpy(szMsg, TEXT(""));
if(pItems)
{
for(x=0;x<nRet;x++)
{
wsprintf(szText, TEXT("%s at index %ld\n"), pTemp[x].pText, pTemp[x].lIndex);
lstrcat(szMsg, szText);
}
/* free the storage */
free(pItems);
}
MessageBox(hCtrl, szMsg, TEXT("Selected Items"), MB_OK);
}
else
MessageBox(hCtrl, TEXT("None"), TEXT("Selected Items"), MB_OK);
if(nRet < 0)
return nRet;
else
return SUCCESS;
}
else
return ERROR_INVALID_PARAMETER;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document