🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4852

FindFirstFile(), FindNextFile() and TreeView

#4852
From: Tomislav
Date: Sat, 19 Nov 2005 13:01
38 lines
2024 bytes
The user selects a directory, and my application searches that directory 
for sub directories and then lists them in RichEdit with full path. For 
searching directories I use FindFirstFile()and FindNextFile(). My 
problem is that I want to use TreeView instead of RichEdit but I don't 
know how add this directories to TreeView to show them like Windows 
Explorer does.

For example when I select c:\ to search for sub directories

My RichEdit displays directories like this

c:\
c:\Folder 1
c:\Folder 1\Folder 1.1
c:\Folder 1\Folder 1.2
c:\Folder 2
c:\Folder 2\Folder 2.1
c:\Folder 2\Folder 2.2
c:\Folder 3
c:\Folder 3\Folder 3.1
c:\Folder 3\Folder 3.2

I would like TreeView to show found directories like this:

- c:\
	- Folder 1
		Folder 1.2
		Folder 1.3
	- Folder 2
		Folder 2.1
		Folder 2.2	
	+ Folder 3	

My problem is the full path that is returned, I tried to extract the 
directories with SubString that searches for "\\" and then I delete 
everything before "\\" and after the next "\\" but I can't make it work. 
Is my approach ok? How should I do this?
Thanks in advance.
Technical Details
Message-ID: <437f21f9@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c9219bd94e2094ee,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Sat, 19 Nov 2005 14:01:46 +0100
From: Tomislav <"rif"@net.hr>
Reply-To:  rif@net.hr
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: FindFirstFile(), FindNextFile() and TreeView
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 213.202.87.114
Message-ID: <437f21f9@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1132405241 213.202.87.114 (19 Nov 2005 05:00:41 -0700)
Lines: 38
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail