This example uses WinQueryLboxCount to find the number of list box items and selects them all.
#define INCL_WINLISTBOXES #define INCL_WINWINDOWMGR #include <OS2.H> LONG cWindows; HWND hwndWindowLB; cWindows = WinQueryLboxCount(hwndWindowLB); /* Loop through all windows, selecting them all */ while (cWindows) { WinSendMsg(hwndWindowLB, LM_SELECTITEM, (MPARAM)--cWindows, (MPARAM)TRUE); }