• Advertisement
Sign in to follow this  

listbox issue returning text

This topic is 4327 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using SendDlgItemMessage to retrieve the text of a selection in a listbox. I'm using a LPCTSTR to receive the text, however, during runtime I recieve a "not defined" debug error. Any ideas what's wrong? What's a good (better) way to retrieve text from a list box item. Preferably so that after the string is retrieved sscanf can use it correctly. Thanks for anyhelp! -stealthgate

Share this post


Link to post
Share on other sites
Advertisement
[source="cpp"]

LRESULT sel = 0;
char *ListBoxItem; //Same as a LPSTR (Long Pointer - String)

HWND SomehWnd = GetDlgItem(dlghwnd, IDD_LISTBOX1); //grab the list box control handle

//Get the current selection of the listbox
sel = SendMessage(SomehWnd, LB_GETCURSEL, 0, 0);
SendMessage( SomehWnd, (UINT) LB_GETTEXT, (WPARAM)sel, (LPARAM)ListBoxItem);





Tell me if it works. I might be missing something important :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement