Sign in to follow this  
ostamo1

win 32 list box

Recommended Posts

is this what i use to get information from a list box?? i have a list box with 3 names in it i want to finds out what name is selected and change some varibles dependent on the names like age favored food and such how do i find out which name was selected i tried reading msdn but it just is confuing me more thanks for your help

Share this post


Link to post
Share on other sites
No, this does not return the actual text. It is used when you have data to store for each item in an owner-drawn listbox.

Use LB_GETCURSEL to find the zero-based index of the selection. If you don't have it stored elsewhere, use LB_GETTEXT to retrieve the item text.

Share this post


Link to post
Share on other sites

int itemID = (int) SendMessage(hwListBox, LB_GETCURSEL, 0,0);

char text[256];
SendMessage(hwListBox, LB_GETTEXT, itemID, (LPARAM) text);



If it's in a dialog box use SendDlgItemMessage(hwDialog, ID_LISTBOX, ...);

Share this post


Link to post
Share on other sites
thanks i really appreciate all the help you have given me
but learning the win 32 api is fifficult and there are not to many tutorials out there that explain things goos enough
(like what to pass into the functions)

so thanks again for all your help

Share this post


Link to post
Share on other sites
Hey, we've all been there :)

When I first started with win32 I couldn't figure out how to process WM_CLOSE properly (it would just hang) so I had all my programs set up so you would double-click to exit them. Changing exactly 1 line fixed it, but it took me ages to figure out.

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