BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Show files from a directory

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using
View previous topic :: View next topic  
Author Message
Rick
Guest





PostPosted: Fri Nov 21, 2003 12:21 am    Post subject: Show files from a directory Reply with quote



Hi,

I have a certain directory filled with files. I want all file from that
directory with extension *.x to be showed in a listbox or something? How to
get these filenames?

Greetings,
Rick


Back to top
Mxking
Guest





PostPosted: Fri Nov 21, 2003 1:34 am    Post subject: Re: Show files from a directory Reply with quote




"Rick" <r.nieuwlaat (AT) planet (DOT) nl> wrote:
Quote:
Hi,

I have a certain directory filled with files. I want all file from that
directory with extension *.x to be showed in a listbox or something? How to
get these filenames?

Greetings,
Rick



What you should do is judge the file extension.You can use
function ExtractFileExt(const FileName: string): string;
to get the file's extension.The return of the above function
is the file's extension.

---
Mxking


Back to top
Martin Harvey (Demon Acco
Guest





PostPosted: Fri Nov 21, 2003 3:18 am    Post subject: Re: Show files from a directory Reply with quote



On Fri, 21 Nov 2003 01:21:57 +0100, "Rick" <r.nieuwlaat (AT) planet (DOT) nl>
wrote:

Quote:
Hi,

I have a certain directory filled with files. I want all file from that
directory with extension *.x to be showed in a listbox or something? How to
get these filenames?

The Delphi library has FindFirst and FindNext functions, which will
work nicely for this. They encapsulate the Win32 API FindFirstFile and
FindNextFile functions.

MH.


Back to top
Dave Keighan
Guest





PostPosted: Fri Nov 21, 2003 3:32 am    Post subject: Re: Show files from a directory Reply with quote

Rick

Quote:
I have a certain directory filled with files. I want all file from
that directory with extension *.x to be showed in a listbox or
something? How to get these filenames?

You can roll your own quick and easy with FindFirst, FindNext ... or go
the custom route - if you plan on any recursion or looking in
sub-directories/folders I'd recommend the custom route.

There are a number of them out there:
http://www.torry.net/search.htm

My preference is:
http://www.delphiarea.com/products/#TFindFile
Slick and easy to use. It has a method that returns each file as it's
found so you can check whatever needs checking and process the
FileMatch as required.

My preference for the list is Virtual TreeView. Takes a bit of mucking
about to get the hang of but very, very cool - even as a listbox.
Alternately, depending on what you may want to do with the files,
there's VirtualShellTools. Find them both at:
http://www.delphi-gems.com/

GL
--
Dave

Back to top
Dave Keighan
Guest





PostPosted: Fri Nov 21, 2003 3:41 am    Post subject: Re: Show files from a directory Reply with quote

Correction

Quote:
there's VirtualShellTools. Find them both at:
http://www.delphi-gems.com/

http://groups.yahoo.com/group/VirtualExplorerTree/?yguid=61839062
for VirtualShellTools. I understand they 'may' be joining/hosted at the
Virtual TreeView site soon.

--
Dave

Back to top
Kurt Barthelmess
Guest





PostPosted: Fri Nov 21, 2003 1:27 pm    Post subject: Re: Show files from a directory Reply with quote

"Rick" <r.nieuwlaat (AT) planet (DOT) nl> wrote:

Quote:
I have a certain directory filled with files. I want all file from that
directory with extension *.x to be showed in a listbox or something? How to
get these filenames?

To get them into a listbox:

var
Dir: array [0..MAX_PATH] of Char;
....
StrCopy(Dir, '*.x');
DlgDirList(Handle, Dir, ListBox1.Handle, 0, DDL_ARCHIVE);

Do not pass a literal directory / file mask to DlgDirList. It wants to
modify that input, so pass it a buffer as shown.

You may want to qualify that mask a bit more. With no drive or base
folder, the results are somewhat arbitrary.

If you want the list in "something" what is the "something"?

Good luck.

Kurt


Back to top
jacob muntner
Guest





PostPosted: Sun Nov 23, 2003 2:41 pm    Post subject: Re: Show files from a directory Reply with quote

"Rick" <r.nieuwlaat (AT) planet (DOT) nl> כתב בהודעה:3fbd5ab0 (AT) newsgroups (DOT) borland.com...
Quote:
Hi,

I have a certain directory filled with files. I want all file from that
directory with extension *.x to be showed in a listbox or something? How
to
get these filenames?

a TFileListBox looks "something" suitable. just fill in it's
directory and mask properties accordingly.
------
jacob



Back to top
Rick
Guest





PostPosted: Mon Nov 24, 2003 8:35 pm    Post subject: Re: Show files from a directory Reply with quote

Thank you all! I got it working now.

Greetings,
Rick


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.