This macro fills the buffer with the text of the indexed item. It returns the length of the text.
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwndLbox; /* List box handle. */ SHORT index; /* Index of the listbox item. */ PSZ psz; /* Pointer to a null terminated string. */ SHORT cchMax; /* Maximum number of characters allocated to the string. */ LONG lRetTxtL; /* Actual text length copied. */ lRetTxtL = WinQueryLboxItemText(hwndLbox, index, psz, cchMax);