I have a ComboBox, defined like this in my resource file: COMBOBOX IDCB_RESOLUTION, 50,50,50,150, CBS_DROPDOWNLIST | WS_TABSTOP | WS_VSCROLL
It's inside a dialog. Adding items to it works, but somehow I can't seem to select an item with sending the SETCURSEL message... Here's the code from the Callback function:
1 2 3 4 5 6 7 8
case WM_INITDIALOG:
HWND HCbBox = GetDlgItem(hWnd, IDCB_RESOLUTION);
std::string strarr[] = {"Hello", "World"};
std::string* end = strarr + sizeof(strarr);
auto lambda = [HCbBox](std::string a){return ComboBox_AddString(HCbBox, a.c_str());};
std::for_each(strarr,end,lambda);
ComboBox_SetCurSel(HCbBox,0);
break;
The items appear in the ComboBox but somehow no item is initially selected.
NVM, it seems my pointers were wrong somehow, which probably broke the function. Using a vector instead works.