Jump to content
  • Advertisement
Sign in to follow this  
nPenAPaT

Dev C++ combobox question

This topic is 4175 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I have the following code in my program:
WNDCLASSEX Class;
 Class.cbSize = sizeof(WNDCLASSEX);
 Class.style = CS_HREDRAW | CS_VREDRAW;
 Class.lpfnWndProc = WindowProcedure;
 Class.cbClsExtra = 0;
 Class.cbWndExtra = 0;
 Class.hInstance = GetModuleHandle(NULL);
 Class.hIcon = NULL;
 Class.hCursor = NULL;
 Class.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
 Class.lpszMenuName = NULL;
 Class.lpszClassName = "MainWindow";
 Class.hIconSm = NULL;
 RegisterClassEx(&Class);
 
 hWindow = CreateWindowEx(WS_EX_CONTROLPARENT|WS_EX_OVERLAPPEDWINDOW,
                          "MainWindow",
                          "MainWindow",
                          WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_VISIBLE,
                          CW_USEDEFAULT,
                          0,
                          SizeX,
                          SizeY,
                          NULL,
                          NULL,
                          GetModuleHandle(NULL),
                          NULL                          
                          );
hComboBox = CreateWindow("combobox",""
,WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST ,
100,16,120,24,hWindow,(HMENU)COMBOBOX,
(HINSTANCE)GetWindowLong(hWindow,GWL_HINSTANCE),NULL);
 
 SendMessage(hComboBox,CB_ADDSTRING,0,(long)"Option One");
 SendMessage(hComboBox,CB_ADDSTRING,0,(long)"Option Two");
 SendMessage(hComboBox,CB_SETCURSEL,1,0);


This compiles and runs correctly in Visual Studio - I get a combobox wiht two options. But in DevC++ this won`t work. I get no entries in the combobox and when I click it it exits the program. So my question is do I have to add some special code to the WindowProcedure to make my combobox work in DevC++ or I have to do something else ? [Edited by - nPenAPaT on July 8, 2007 10:24:39 AM]

Share this post


Link to post
Share on other sites
Advertisement
[ source ]
[ /source ] tags are your friend


Other than that...

Why use DevC++ when you have VS?

The problem might be with Unicode settings. VS's default settings might be different from what DevC++ uses.

Share this post


Link to post
Share on other sites
Thanks Antheus. From now on I will use source tags. And thaks for the suggestion. It seems i forgot to turn on the XP themes support.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!