I tried to populated a combo box on a DIALOG with following code:
TCHAR szTmp[64];
for (i = 0; i < 10; i++)
{
wsprintf(szTmp, TEXT("Item %d"), i);
SendDlgItemMessage(hwnd, IDC_COMBO,CB_INSERTSTRING, (WPARAM)i, (LPARAM)szTmp);
}
SendDlgItemMessage(hBaudRate, IDC_COMBO, CB_SETCURSEL, (WPARAM)0, (LPARAM)0);
That did not work. Please let know what I am missing.
If both calls to
SendDlgItemMessage()are operating on the same ComboBox, thenhwndshould be changed tohBaudRate, or vice versa.Also, the
WPARAMof theCB_INSERTSTRINGmessage should be changed to-1, or else useCB_ADDSTRINGinstead.