Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ListBox

ListBox

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestionlearning
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mike Winter
    wrote on last edited by
    #1

    Hi again I am embarrassed to ask this question, but hey, if you dont ask, you dont get to know... I have an application written by others that generates an Edit Box by using the following code: HWND hwndEdit; hwndEdit = CreateWindowEx(WS_EX_CLIENTEDGE, _T("EDIT"), "", WS_CHILD|WS_VISIBLE|WS_TABSTOP, 20,25,200,23, hWnd, NULL, hInstance, NULL); I now want to add to the program by including a ListBox. Can I do this by: HWND hwndList; hwndList = CreateWindowEx(WS_EX_CLIENTEDGE, _T("LISTBOX"), "", WS_CHILD|WS_VISIBLE|WS_TABSTOP, 20,25,200,23, hWnd, NULL, hInstance, NULL); (changing the co-ords, of course) This does appear to work, but I cant work out how to add strings to the ListBox - can anyone help, or show me what I am doing wrong Thanks for any help that you can give to a newbie! Mike

    B 1 Reply Last reply
    0
    • M Mike Winter

      Hi again I am embarrassed to ask this question, but hey, if you dont ask, you dont get to know... I have an application written by others that generates an Edit Box by using the following code: HWND hwndEdit; hwndEdit = CreateWindowEx(WS_EX_CLIENTEDGE, _T("EDIT"), "", WS_CHILD|WS_VISIBLE|WS_TABSTOP, 20,25,200,23, hWnd, NULL, hInstance, NULL); I now want to add to the program by including a ListBox. Can I do this by: HWND hwndList; hwndList = CreateWindowEx(WS_EX_CLIENTEDGE, _T("LISTBOX"), "", WS_CHILD|WS_VISIBLE|WS_TABSTOP, 20,25,200,23, hWnd, NULL, hInstance, NULL); (changing the co-ords, of course) This does appear to work, but I cant work out how to add strings to the ListBox - can anyone help, or show me what I am doing wrong Thanks for any help that you can give to a newbie! Mike

      B Offline
      B Offline
      Blake Miller
      wrote on last edited by
      #2

      Send the listbox the LB_ADDSTRING message. char szMyString[64]; strcpy(szMyString, "This is my string."); lResult = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)szMyString ); The string should end up in the list box. See other LB_??? messages for the other actions you can perform on the listbox. People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks

      M 1 Reply Last reply
      0
      • B Blake Miller

        Send the listbox the LB_ADDSTRING message. char szMyString[64]; strcpy(szMyString, "This is my string."); lResult = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)szMyString ); The string should end up in the list box. See other LB_??? messages for the other actions you can perform on the listbox. People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks

        M Offline
        M Offline
        Mike Winter
        wrote on last edited by
        #3

        Your a Star! I have just tried that and it works - simple! Thank you very much Mike

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups