Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load list details with SendMessage API? 1

Status
Not open for further replies.

asjeff

Programmer
Oct 8, 2001
107
GB
I am wanting to load a listbox with all the names in a folder on my network. Can the SendMessage API be used for this or is there another way?

Currently I loop through the folder using the FileSystemObject method and populate the listbox with the .additem method, but it's very slow as there are 12000 files in this folder.

Can anyone suggest a quicker method?

Many thanks

Asjeff
 
Did you look at the FileListBox control?
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Johnwn - The FileListBox is great as far as it goes but my problem is that the files in my folder are named one of two ways - the files that I am interested in are named with a 6 figure number (eg 400666.doc), and the rest are named with a three letter prefix and then a number (eg asj4552.doc). Presently there are about 12000 number files and 28000 letter files in the folder and I need to sift out the number files only. Unfortunately I don't know of any method of filtering the pattern to distinguish the filename rather that the extension. This is why I am trying to find an alternative (and quicker) method of filtering and loading the files to the list. Also as these files are being added to frequently every day so I will need a method to load current information each time the list is loaded.

Hope this make sense

Asjeff
 
I'm clutching a straw here but....
Your examples show the 'number' files with 6 character names and your 'letter' files with 7 characters. If this is a general rule you can use ??????.* as your filelistbox pattern. It will return all filenames up to 6 characters long

If not, I'll have to think again!
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Thanks johnwn - that's narrowed it down to pretty much only those I want - I was trying to set the pattern to ######.* which wasn't returning anything, so thanks for pointing me in the right direction.

Have a star on me.
 
You're welcome - Thank You! [smile]
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top