Retrieve the text from all highlighted items in either a Single-selection or a Multiple-select List Box control.
cGetLBSelText (window-handle)
(i) window-handle Windows handle to a List Box control.
(s) item-text-list A tab delimited list of the text associated
with each selected item
Use this function to retrieve the text from all highlighted items in either a Single-selection or a Multiple-select List Box control. The text from each item is separated by a @TAB character when more than one item is highlighted. This function differs from cGetLBText. cGetLBSelText returns the text for selected items, whereas, cGetLBText returns the text from all items in the control.
Some List Boxes store text in a non standard, application specific way. CGetLBSelText can not retrieve text from these List Boxes and will generate a runtime error. If a List Box control does not have any items selected or does not have any items in its list, this function will return the string "*EMPTY*"
The class name for List Box controls is "List Box".
AddExtender("wwctl44i.dll",0,"wwctl64i.dll") hwndParent = DllHwnd("Microsoft Control Spy -") ;Get the handle of the parent window of the list box control. hwnd = cWndbyclass(hwndParent, "ListBox") ; Clear any current selections If !cClearLbAll(hwnd) Goto ErrorHandler EndIf ; Select the first and fifth items in the list If ! cSetLbItemEx(hwnd, "1 5") Goto ErrorHandler EndIf ; Get the selected items text SelectedText = cGetLbSelText(hwnd) SelectedText = StrReplace(SelectedText, @TAB, @CRLF) Message("Selected Text", SelectedText) Exit