   [C++, MFC] ComboBox access
  Hello GameDevs !I have this dialog resource containing a combobox which I create like thisHWND hWndDlg = CreateDialog( 0, MAKEINTRESOURCE( IDD_DIALOG1 ), hWndMain, (DLGPROC)DlgProc );What I am wondering is how do I reach it in order to useSendMessage( hWndCb, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>( "Text item" ) );I had hoped it would work like this but it doesn't :/HWND hWndCb = GetDlgItem( hWndDlg , IDC_COMBO1 );Many thanks for any help on this.   
  That should work. Are you sure that hWndDlg is the combo box's parent and that IDC_COMBO1 is its ID?   ;Quote:Original post by jwezorekThat should work. Are you sure that hWndDlg is the combo box's parent and that IDC_COMBO1 is its ID?Well, the way I figured the dialog would be a parent of the combobox is that I added it graphically in the resource editor when I created the dialog resource (so I might have things completely confused here). It seems that if I create a combobox by using CreateWindowEx() and pass hWndDlg as its parent, it works and I get a combobox with controllable content, however the one that came with the dialog itself is shown as well.  RECT rc = { 0, 0, 150, 600 };DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | CBS_NOINTEGRALHEIGHT | CBS_AUTOHSCROLL;HWND hWndCb = CreateWindowEx( 0,//extended styles"Combobox",//control 'class' name"",//control captiondwStyle,//control style rc.left,//position: leftrc.top,//position: toprc.right,//widthrc.bottom,//heighthWndDialog,//parent window handle(HMENU)IDC_COMBO1,   //control's ID0,//application instance0 );//user defined infoSendMessage( hWndCb, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>( "Text Item" ) );This works, but I would like to control the combobox I added when I created the dialog resource. GetDlgItem( hWndDlg , IDC_COMBO1 ) does return a valid handle, but either SendMessage() isn't able to use it or there is some kind of display error :/   ;  Ok, "display error", I had just failed to give the combobox enough space to draw the dropdown portion in the resource editor... A very embarrassing mistake, thanks for taking the time to help this poor noob x)[Edit] Actually I am suprised at how cryptic the area control was. First I'd have to click the dropdown button once, and only then would I be able to adjust the dropdown area vertically? Oh well...   ;Quote:Original post by VanderryOk, "display error", I had just failed to give the combobox enough space to draw the dropdown portion in the resource editor... A very embarrassing mistake, thanks for taking the time to help this poor noob x)No problem and don't be embarrassed; combo boxes are weird and the documentation isn't clear that you have to create them the size that they will be when they are expanded. I still occasionally make that mistake with combo boxes; in fact, I should have guessed that that was the problem. 