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. Win32 to MFC

Win32 to MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
4 Posts 3 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.
  • N Offline
    N Offline
    NaveenHS
    wrote on last edited by
    #1

    Hello All, I have used the List Control in Win32, same i want to implement in MFC, i am unable to do that can anyone help me with this. Extracting the contents of the list Box in Win 32.

    HWND hList = GetDlgItem(hwnd, IDC_FLIST);
    int count = SendMessage(hList, LB_GETCOUNT, 0, 0);
    for ( int i=0; i < count ; i++ )
    {
    int itemTextLen = SendMessage(hList, LB_GETTEXTLEN, i, 0);
    char *itemText = new char[itemTextLen];
    SendMessage(hList, LB_GETTEXT, i, (LPARAM)itemText);
    }

    MFC:-

    int ListSize;
    ListSize = m_WLinks.GetCount();
    for(int i=0;i<=ListSize;i++)
    {
    }

    In Win32 i had handle so got the control of the list box but how to do that in MFC ? Thanking you, Naveen HS.

    S F 2 Replies Last reply
    0
    • N NaveenHS

      Hello All, I have used the List Control in Win32, same i want to implement in MFC, i am unable to do that can anyone help me with this. Extracting the contents of the list Box in Win 32.

      HWND hList = GetDlgItem(hwnd, IDC_FLIST);
      int count = SendMessage(hList, LB_GETCOUNT, 0, 0);
      for ( int i=0; i < count ; i++ )
      {
      int itemTextLen = SendMessage(hList, LB_GETTEXTLEN, i, 0);
      char *itemText = new char[itemTextLen];
      SendMessage(hList, LB_GETTEXT, i, (LPARAM)itemText);
      }

      MFC:-

      int ListSize;
      ListSize = m_WLinks.GetCount();
      for(int i=0;i<=ListSize;i++)
      {
      }

      In Win32 i had handle so got the control of the list box but how to do that in MFC ? Thanking you, Naveen HS.

      S Offline
      S Offline
      SandipG
      wrote on last edited by
      #2

      See here[^] and here[^] I hope it helps.

      Regards, Sandip.

      1 Reply Last reply
      0
      • N NaveenHS

        Hello All, I have used the List Control in Win32, same i want to implement in MFC, i am unable to do that can anyone help me with this. Extracting the contents of the list Box in Win 32.

        HWND hList = GetDlgItem(hwnd, IDC_FLIST);
        int count = SendMessage(hList, LB_GETCOUNT, 0, 0);
        for ( int i=0; i < count ; i++ )
        {
        int itemTextLen = SendMessage(hList, LB_GETTEXTLEN, i, 0);
        char *itemText = new char[itemTextLen];
        SendMessage(hList, LB_GETTEXT, i, (LPARAM)itemText);
        }

        MFC:-

        int ListSize;
        ListSize = m_WLinks.GetCount();
        for(int i=0;i<=ListSize;i++)
        {
        }

        In Win32 i had handle so got the control of the list box but how to do that in MFC ? Thanking you, Naveen HS.

        F Offline
        F Offline
        Franck Paquier
        wrote on last edited by
        #3

        good morning in MFC what you can do is define a member in your mydialog.h CListBox m_MyListBox; use DDX to link you member with the control. DDX_Control(pDX, IDC_MYLIST_BOX, m_MyListBox) Then to read the content CString sText; int ListSize = m_WLinks.GetCount(); for(int i=0; i!=ListSize; ++i) { m_MyListBox.GetText(iIndex, sText); } Regards Franck

        N 1 Reply Last reply
        0
        • F Franck Paquier

          good morning in MFC what you can do is define a member in your mydialog.h CListBox m_MyListBox; use DDX to link you member with the control. DDX_Control(pDX, IDC_MYLIST_BOX, m_MyListBox) Then to read the content CString sText; int ListSize = m_WLinks.GetCount(); for(int i=0; i!=ListSize; ++i) { m_MyListBox.GetText(iIndex, sText); } Regards Franck

          N Offline
          N Offline
          NaveenHS
          wrote on last edited by
          #4

          Hello Sir, Thank you very much for the response. In the Loop i just added this line , with .GetText method its working now. m_MyListBox.GetText(iIndex, sText);

          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