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. How to display the content of particular folder in Tree control?

How to display the content of particular folder in Tree control?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialdata-structuresxmlhelpquestion
10 Posts 6 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.
  • A Offline
    A Offline
    AnithaSubramani
    wrote on last edited by
    #1

    Hi All, Im using CTreectrl. I need to display the content of particular folder. The folder is "Sample" it has sam.txt, example.txt ,book.xml etc. How to display the Folder(Sample) and it content. Please help me.......... Thanks & Regards, Anitha

    I _ S 3 Replies Last reply
    0
    • A AnithaSubramani

      Hi All, Im using CTreectrl. I need to display the content of particular folder. The folder is "Sample" it has sam.txt, example.txt ,book.xml etc. How to display the Folder(Sample) and it content. Please help me.......... Thanks & Regards, Anitha

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      In the old days, there was a very nice function called DlgDirList (and DlgDirListComboBox) which filled a listbox / combobox with the files in a directory. But there is no equivalent for a Tree Control, sorry. You need to combine two bits of knowledge: 1/ FindFirstFile / FindNextFile to loop through all the files in a directory that match (eg) "*.txt". FindFirstFile has a decent bit of code sample in its documentation that will be better than anything I can quickly type. 2/ And CTreeCtrl::InsertItem to put those items in the tree. Lastly, download my article: http://www.codeproject.com/KB/system/Drive_Detect.aspx[^], and look in the code. It has code to construct an imagelist with the pictures for the different drives in it. This stage is optional, but little pretty pictures never hurt! Good luck, Iain.

      In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!

      E M 2 Replies Last reply
      0
      • A AnithaSubramani

        Hi All, Im using CTreectrl. I need to display the content of particular folder. The folder is "Sample" it has sam.txt, example.txt ,book.xml etc. How to display the Folder(Sample) and it content. Please help me.......... Thanks & Regards, Anitha

        _ Offline
        _ Offline
        _AnsHUMAN_
        wrote on last edited by
        #3

        Use FindFirstFile/FindNextFile api's to get the content of the folder. You can check using WIN32_FIND_DATA if the specific object is a file or a folder.

        You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

        1 Reply Last reply
        0
        • A AnithaSubramani

          Hi All, Im using CTreectrl. I need to display the content of particular folder. The folder is "Sample" it has sam.txt, example.txt ,book.xml etc. How to display the Folder(Sample) and it content. Please help me.......... Thanks & Regards, Anitha

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #4

          You know, CodeProject has a whole section of articles on tree-controls[^], including this one[^]. Do try and show some initiative. You managed to find this site - searching it and finding that article would have been the ideal next step...

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

          E 1 Reply Last reply
          0
          • I Iain Clarke Warrior Programmer

            In the old days, there was a very nice function called DlgDirList (and DlgDirListComboBox) which filled a listbox / combobox with the files in a directory. But there is no equivalent for a Tree Control, sorry. You need to combine two bits of knowledge: 1/ FindFirstFile / FindNextFile to loop through all the files in a directory that match (eg) "*.txt". FindFirstFile has a decent bit of code sample in its documentation that will be better than anything I can quickly type. 2/ And CTreeCtrl::InsertItem to put those items in the tree. Lastly, download my article: http://www.codeproject.com/KB/system/Drive_Detect.aspx[^], and look in the code. It has code to construct an imagelist with the pictures for the different drives in it. This stage is optional, but little pretty pictures never hurt! Good luck, Iain.

            In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!

            E Offline
            E Offline
            Eytukan
            wrote on last edited by
            #5

            Iain Clarke wrote:

            In the old days, there was a very nice function called DlgDirList (and DlgDirListComboBox) which filled a listbox / combobox with the files in a director

            In VB6, a directory control used to fill & display file/directory contents automatically. Intelligent eh? :D

            He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

            I 1 Reply Last reply
            0
            • S Stuart Dootson

              You know, CodeProject has a whole section of articles on tree-controls[^], including this one[^]. Do try and show some initiative. You managed to find this site - searching it and finding that article would have been the ideal next step...

              Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

              E Offline
              E Offline
              Eytukan
              wrote on last edited by
              #6

              :omg: that's too much for a single control. Looks like they can host a separate forum for TreeView. lol

              He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

              1 Reply Last reply
              0
              • I Iain Clarke Warrior Programmer

                In the old days, there was a very nice function called DlgDirList (and DlgDirListComboBox) which filled a listbox / combobox with the files in a directory. But there is no equivalent for a Tree Control, sorry. You need to combine two bits of knowledge: 1/ FindFirstFile / FindNextFile to loop through all the files in a directory that match (eg) "*.txt". FindFirstFile has a decent bit of code sample in its documentation that will be better than anything I can quickly type. 2/ And CTreeCtrl::InsertItem to put those items in the tree. Lastly, download my article: http://www.codeproject.com/KB/system/Drive_Detect.aspx[^], and look in the code. It has code to construct an imagelist with the pictures for the different drives in it. This stage is optional, but little pretty pictures never hurt! Good luck, Iain.

                In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!

                M Offline
                M Offline
                Michael Schubert
                wrote on last edited by
                #7

                Iain Clarke wrote:

                In the old days, there was a very nice function called DlgDirList (and DlgDirListComboBox) which filled a listbox / combobox with the files in a directory.

                Still possible: CListBox::Dir CComboBox::Dir

                I E 2 Replies Last reply
                0
                • M Michael Schubert

                  Iain Clarke wrote:

                  In the old days, there was a very nice function called DlgDirList (and DlgDirListComboBox) which filled a listbox / combobox with the files in a directory.

                  Still possible: CListBox::Dir CComboBox::Dir

                  I Offline
                  I Offline
                  Iain Clarke Warrior Programmer
                  wrote on last edited by
                  #8

                  Granted - it's still there, it's just not of use to the original poster! I never had to use it, but I did think it was nifty. Iain.

                  In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!

                  1 Reply Last reply
                  0
                  • E Eytukan

                    Iain Clarke wrote:

                    In the old days, there was a very nice function called DlgDirList (and DlgDirListComboBox) which filled a listbox / combobox with the files in a director

                    In VB6, a directory control used to fill & display file/directory contents automatically. Intelligent eh? :D

                    He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

                    I Offline
                    I Offline
                    Iain Clarke Warrior Programmer
                    wrote on last edited by
                    #9

                    I never had to use VB (well, not much) but I thought it was great up to a point. But I was too much of a control and speed freak... Iain.

                    In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!

                    1 Reply Last reply
                    0
                    • M Michael Schubert

                      Iain Clarke wrote:

                      In the old days, there was a very nice function called DlgDirList (and DlgDirListComboBox) which filled a listbox / combobox with the files in a directory.

                      Still possible: CListBox::Dir CComboBox::Dir

                      E Offline
                      E Offline
                      Eytukan
                      wrote on last edited by
                      #10

                      Wow. never knew that one. 5

                      He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

                      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