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. Retrieve TreeView Selected Item

Retrieve TreeView Selected Item

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
7 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.
  • F Offline
    F Offline
    Fareed Rizkalla
    wrote on last edited by
    #1

    I finally managed to put my TreeView List together, only to find out I'm unable to retrieve the selection. Does anyone know how to get the selection?

    N R 2 Replies Last reply
    0
    • F Fareed Rizkalla

      I finally managed to put my TreeView List together, only to find out I'm unable to retrieve the selection. Does anyone know how to get the selection?

      N Offline
      N Offline
      Niklas L
      wrote on last edited by
      #2

      TreeView_GetSelection[^] for non-MFC or CTreeCtrl::GetSelectedItem[^] for MFC.

      home

      F 1 Reply Last reply
      0
      • N Niklas L

        TreeView_GetSelection[^] for non-MFC or CTreeCtrl::GetSelectedItem[^] for MFC.

        home

        F Offline
        F Offline
        Fareed Rizkalla
        wrote on last edited by
        #3

        But that returns an HTREEITEM, can't find any details on this structure on MSDN.

        N 1 Reply Last reply
        0
        • F Fareed Rizkalla

          But that returns an HTREEITEM, can't find any details on this structure on MSDN.

          N Offline
          N Offline
          Niklas L
          wrote on last edited by
          #4

          You can use that handle to access the item using TreeView_GetItem[^] or CTreeCtrl::GetItem[^]. Read about the TVITEM[^] structure.

          home

          F 1 Reply Last reply
          0
          • N Niklas L

            You can use that handle to access the item using TreeView_GetItem[^] or CTreeCtrl::GetItem[^]. Read about the TVITEM[^] structure.

            home

            F Offline
            F Offline
            Fareed Rizkalla
            wrote on last edited by
            #5

            TVITEM* Selected; TreeView_GetItem( HandleforTreeList, Selected); Fails saying uninitialized variable!

            N 1 Reply Last reply
            0
            • F Fareed Rizkalla

              TVITEM* Selected; TreeView_GetItem( HandleforTreeList, Selected); Fails saying uninitialized variable!

              N Offline
              N Offline
              Niklas L
              wrote on last edited by
              #6

              That is no surprise. TVITEM item; item.mask = ; ... TreeView_GetItem( HandleforTreeList, &item);

              home

              1 Reply Last reply
              0
              • F Fareed Rizkalla

                I finally managed to put my TreeView List together, only to find out I'm unable to retrieve the selection. Does anyone know how to get the selection?

                R Offline
                R Offline
                rahul kulshreshtha
                wrote on last edited by
                #7

                Checkout this http://msdn.microsoft.com/en-us/library/2t67x9cw%28v=VS.80%29.aspx[^]

                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