Combo Box refuses to work (C/C++, not MFC).

Started by
3 comments, last by blueshogun96 12 years, 6 months ago
Sorry if the solution to this is simple, but I've searched and experimented for hours and hours and can't get this to work to save my life. I've been trying to add this combo box for use in things like display move/monitor enumeration for my project (I hate being forced to default to the primary display adapter), and this combo box is a real pain. Now, I did get the list elements to be added into the box, but the list won't show up when I click it. I can scroll though it using the arrow keys, but that's about it. I have absolutely no idea why this refuses to work. I wrote a little test code to make sure it works (called at WM_INITDIALOG). Did I do anything wrong here?

SendDlgItemMessage( hWnd, IDC_COMBO1, CB_RESETCONTENT, 0, 0 );
SendDlgItemMessage( hWnd, IDC_COMBO1, CB_SHOWDROPDOWN, TRUE, 0 );
SendDlgItemMessage( hWnd, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM) "Primary Display Driver" );
SendDlgItemMessage( hWnd, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM) "3Dfx Voodoo3" );
SendDlgItemMessage( hWnd, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM) "NVIDIA Riva128" );
SendDlgItemMessage( hWnd, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM) "ATI Radeon 7500" );
SendDlgItemMessage( hWnd, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM) "Hercules Kyro II" );
SendDlgItemMessage( hWnd, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM) "Matrox G400" );
SendDlgItemMessage( hWnd, IDC_COMBO1, CB_SETCURSEL, 0, 0 );



Of course, don't take those card names too seriously here, it's just a test. So what do you think I'm doing wrong here? This sucks. Any ideas? Thanks.
Advertisement
This is probably a stupid answer but have you tried (WPARAM) casting the bool value in the CB_SHOWDROPDOWN message?
Tried it. Didn't work. Any more ideas?
My first guess would be that you need to adjust the expanded size of the control in the resource editor. It won't drop down if it's not big enough. See http://msdn.microsoft.com/en-us/library/4cta1x1t.aspx
Wow, I feel stupid! But I didn't know you could control the length of the drop box. That fixed it. Thanks!

This topic is closed to new replies.

Advertisement