WinQueryLboxCount
Appearance
This macro returns the number of items in the List Box.
Syntax
WinQueryLboxCount(hwndLbox)
Parameters
- hwndLbox (HWND) - Input
- Listbox handle.
Returns
- lRetNumIt (LONG) - returns
- Number of items in the list box.
Remarks
This macro is defined as&colon.
#define WinQueryLboxCount(hwndLbox) \ ((LONG)WinSendMsg(hwndLbox, \ LM_QUERYITEMCOUNT, \ (MPARAM)NULL, \ (MPARAM)NULL))
This macro requires the existence of a message queue.
Example Code
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwndLbox; /* Listbox handle. */ LONG lRetNumIt; /* Number of items in the list box. */ lRetNumIt = WinQueryLboxCount(hwndLbox);
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); }