Hey everyone,
I seem to be having some trouble adding strings to my combo boxes which is in a Dialog I made (I think its modal, called with the DialogBox() function). Here's my code:
Dialog Message Loop:
INT_PTR CALLBACK SettingsBox(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
//UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
{
LoadSettingsBox(hDlg);
return (INT_PTR)TRUE;
}
case WM_COMMAND:
if (LOWORD(wParam) == IDCANCEL)
{
PostQuitMessage(0);
gSettingsDone = true;
gSettingsCancel = true;
EndDialog(hDlg, LOWORD(wParam));
DestroyWindow(g_hWnd);
return (INT_PTR)TRUE;
}
if (LOWORD(wParam) == IDOK)
{
EndDialog(hDlg, LOWORD(wParam));
gSettingsDone = true;
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}
LoadSettingsBox() function which populates the ComboBoxes etc:
void LoadSettingsBox(HWND hDlg)
{
//resBox=(CComboBox *)GetDlgItem(hDlg, IDC_RESOLUTION);
// resBox->SetDlgCtrlID(IDC_RESOLUTION);
//resBox->AddString((LPCSTR)"Test");
HWND hRes = GetDlgItem(hDlg, IDC_RESOLUTION);
SendMessage(hDlg, CB_INSERTSTRING, 0, (LPARAM)"640x480");
//SendDlgItemMessage(hDlg, IDC_RESOLUTION, WM_SETTEXT, 0, (LPARAM)"640x480");
/*SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "800x600", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1024x768", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1152x864", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1280x720", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1280x1024", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1360x768", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1360x1024", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1440x900", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1600x1200", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1680x1050", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1792x1344", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1800x1440", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1856x1392", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1920x1080", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1920x1200", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "1920x1440", 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, "2048x1536", 0);*/
}
As you can see I commented a lot out of the LoadSettingsBox because I couldn't even get one of the strings to be added to the combo box.
Nothing appears. Nothing... I've tried manipulating all of the ComboBox properties and everything. The combobox ID is IDC_RESOLUTION.
I also tried using MFC, which I've never used before, with the CComboBox class, but looking at the header files of said class shows that it's using the same routine I'm using.
Does anyone know why nothing is being added?
Anyone got any working examples? I'm at a loss...