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