This example calls WinInsertLboxItem to insert items in a list box as part of initializing a dialog (WM_INITDLG message).

#define INCL_WINWINDOWMGR       /* Window Manager Functions     */
#define INCL_WINLISTBOXES       /* Window List Box definitions  */
#include <os2.h>

LONG    lIndex;         /* inserted item index                  */
HWND    hwndLbox;       /* list box window handle               */
MPARAM  mpParam1;       /* Parameter 1 (window handle)          */
/* Array of list box item names */
PSZ     pszItems[3] = {"Item1", "Item2", "Item3"};

case WM_INITDLG:
       .
       .
     /*******************************/
     /* Initialize List Box Control */
     /*******************************/

     /* get handle of list box */
     hwndLbox = HWNDFROMMP(mpParam1);

     /* insert 3 items into list box */
     lIndex = WinInsertLboxItem(hwndLbox, LIT_END, pszItems[0]);
     lIndex = WinInsertLboxItem(hwndLbox, LIT_END, pszItems[1]);
     lIndex = WinInsertLboxItem(hwndLbox, LIT_END, pszItems[2]);
       .
       .


[Back] [Next]