# 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.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 ,
(HINSTANCE)GetWindowLong(hWindow,GWL_HINSTANCE),NULL);

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 wont 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 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 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.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
627746
• Total Posts
2978905

• 10
• 10
• 21
• 14
• 14