Sign in to follow this  
kelcharge

Retrieving items from a drop-down menu?

Recommended Posts

Lets say for example that I have a calculator program. This program has a drop down with "Multiply", and "Divide" in it. How would I retrieve which one is selected in the drop down? This is in C++ and Win32.

Share this post


Link to post
Share on other sites
Quote:
Original post by kelcharge
I still cannot figure out how to use CB_GETCURSEL. The MSDN site doesn't really help me a whole lot.


int index = (int)::SendMessage(hwnd, CB_GETCURSEL, 0, 0);

where "hwnd" is the handle to the ComboBox.

The index corresponds to whichever string is selected in your combo box.

Multiply = 0
Divide = 1

That's how you'd know which one was selected.



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