Adding Items to a Combo Box

I successfully created a combo box, but I can't figure out how to add items to it. I have the following code:

1
2
case WM_CREATE:
CreateObjects(hWnd);


1
2
3
4
5
6
7
8
9
10
11
12
13
14
void CreateObjects(HWND hWnd)
{
     . . .
    HWND frm4, cmb_box1 ;
    frm4 = CreateWindow(TEXT("button"), TEXT("Step4: Options"), VISIBLE | WS_CHILD | BS_GROUPBOX, 275, 216, 225, 105, hWnd, (HMENU) 9, NULL, NULL);

cmb_box1 = CreateWindow(TEXT("combobox"), NULL, WS_VISIBLE | WS_CHILD | WS_TABSTOP, 128, 72, 81, 21, frm4, (HMENU) 12, NULL, NULL);

   const TCHAR* ComboBoxItems[] = { _T( "Item1" ), _T( "Item2" ), _T( "Item3" ) };

SendMessage(cmb_box1, CB_ADDSTRING, 0, (LPARAM) ComboBoxItems[0]);

}


As mentioned above, the combo box is created, but it is empty. I tried GetNextError(), but returns 0; suggesting that there is nothing wrong.
Help greatly appreciated.

Thanks,

DominicanJB
Last edited on
Topic archived. No new replies allowed.