Sign in to follow this  
stealthgate

listbox issue returning text

Recommended Posts

stealthgate    124
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
Riekistyx    100
[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

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