Based on
this article[
^], to make you code work, you need additional initialization as show in the example bellow:
int xpos = 100;
int ypos = 100;
int nwidth = 200;
int nheight = 200;
HWND hwndParent = m_hwnd;
HWND hWndComboBox = CreateWindow(WC_COMBOBOX, TEXT(""),
CBS_DROPDOWN | CBS_HASSTRINGS | WS_CHILD | WS_OVERLAPPED | WS_VISIBLE,
xpos, ypos, nwidth, nheight, hwndParent, NULL, HINST_THISCOMPONENT,
NULL);
SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM)TEXT("Item1"));
SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM)TEXT("Item2"));
SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM)TEXT("Item3"));
SendMessage(hWndComboBox, CB_SETCURSEL, (WPARAM)2, (LPARAM)0);