-
April 26th, 2004, 03:39 PM
#1
ListBox and SDK
Hi Friends
I am creating and filling a ListBox (n no. of strings) at runtime with following code
CWnd *ctrl;
ctrl = new CWnd;
Code:
ctrl->Create(_T(m_ctrl_type),"",m_style,CRect(m_ctrl_pos_x,m_ctrl_pos_y,m_ctrl_height,m_ctrl_width),this,51);
Code:
::SendMessage(ctrl->m_hWnd,LB_ADDSTRING,0,LPARAM(LPCTSTR(m_disp_string)));
Now, I want to read the string user has selected.
I am able to read ComboBox (created in same way )using GetDlgItemText function.
Pls. enlighten me.
Thanks
Milind
-
April 26th, 2004, 03:45 PM
#2
LB_GETCURSEL + LB_GETTEXT
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
April 26th, 2004, 03:48 PM
#3
You mean call sendmessage with LB_GETCURSEL + LB_GETTEXT in one call
or 2 calls one by one ?
if in one call, can you write a single line, how to call .
Thanks
Milind
-
April 26th, 2004, 04:08 PM
#4
Two calls.
You send message LB_GETCURSEL to find out which item is currently selected, then you send message LB_GETTEXT to get its text.
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|