win 32 list box

Started by
9 comments, last by uavfun 19 years, 7 months ago
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
Advertisement
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.
can u please give me an example
i would really appreciate it.
and i thank you for answering ALL my newbie questions lately
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, ...);
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
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.
hey is thereany way i can return a negative number to an edit box
or static box and show it in the window instead of 4929blah


i would like it to say -1 or -2
Set the last parameter of SetDlgItemInt to TRUE
that was so easy it makes me pissed off i could not figure that out

oh well thanks a whole bunch for your help

and also your project looks cool


Quote:Original post by ostamo1
and also your project looks cool


Thanks :)

This topic is closed to new replies.

Advertisement