Get a count of items in a List Box control.
cGetLBCount (window-handle)
(i) window-handle window handle to a List Box control.
(i) count number of items in List Box
Note: Use this function to get a count of items in a List Box control. The function can obtain the count for "Owner Drawn" and non-text item List Boxes, as well as, conventional List Boxes.
AddExtender("wwctl44i.dll",0,"wwctl64i.dll")
hwndParent = DllHwnd("Microsoft Control Spy -") hwnd = cWndbyclass(hwndParent, "ListBox") ; Clear any current selections If !cClearLbAll(hwnd) Goto ErrorHandler EndIf ; Get the number of items in the List Box. nCount = cGetLbCount(hwnd) ; Select the last item in the list box If ! cSetLbItemEx(hwnd, nCount) Goto ErrorHandler EndIf ; Get the selected items text SelectedText = cGetLbSelText(hwnd) Message("Last Item’s Text", SelectedText) Exit
cGetLBText, cSetLBItem, cGetLBSelText, cSetLBItemEX, cClearLBAll