Sign in to follow this  
nPenAPaT

Dev C++ combobox question

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
[ 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this