-
Initializing Combo Box
Hi and thanks for reading this.
I want to initialize a combo box.When I create the dialog, in which the box will be, I send CB_ADDSTRING to the box, but it doesn't works
Here is the code:
theWnd=CreateDialog(hInst,MAKEINTRESOURCE(IDD_PROB A),NULL,DlgProc);
i=GetLastError();
SendDlgItemMessage(theWnd,IDC_COMBO1,CB_ADDSTRING, 0,(LPARAM) "some text");
ShowWindow(theWnd, SW_SHOW);
If you can, please tell me why
-
Try sending the CB_ADDSTRING message within a WM_INITDIALOG message handler.
-
I believe you should do the following...
Code:
...
case WM_INITDIALOG:
HWND hCB = GetDlgItem(hDlg, IDC_COMBO1); // Get HWND of Combo Box, hDlg is handle sent to DLGPROC
SendMessage(hCB, CB_ADDSTRING, 0, (LPARAM)"Some Text");
break;
....