ListBox and SDK
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: ListBox and SDK

  1. #1
    Join Date
    Feb 2001
    Location
    India
    Posts
    21

    Question 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

  2. #2
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,553
    LB_GETCURSEL + LB_GETTEXT
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinViewer - an integrated GDI objects viewer for Visual C++ Debugger, and more...

  3. #3
    Join Date
    Feb 2001
    Location
    India
    Posts
    21
    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

  4. #4
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,553
    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:
    FeinViewer - an integrated GDI objects viewer for Visual C++ Debugger, 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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center