Results 1 to 6 of 6

Thread: Scan Hard Disk for JPG files

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Leeds, UK
    Posts
    287

    Question

    Hi,

    I would like to know how to scan the hard drive for any JPG files and then store them in a array of strings for example:

    1) "C:\windows\setup.jpg"
    2) "C:\images\frog.jpg"

    Does anybody out there have a clue as to how I would go about doing something like this?

    Thanks!

  2. #2
    Addicted Member jcouture100's Avatar
    Join Date
    Aug 1999
    Posts
    141
    Check out the tip "How to find files using Windows API" at:

    http://www.vb-world.net/tips/tip59.html

    It uses API calls to do a recursive directory search. I've used some of the code in several of my apps and it works great. Strip the recursive search code from the demo project and supply the search parameters you need from your own user interface or code.
    JC

  3. #3
    Registered User Lior's Avatar
    Join Date
    Jan 2000
    Posts
    307
    Guys,
    I think there is no need for using the API functions.
    If I'm not mistaken Microsoft has included a project in their \SAMPLES directory, which searches the HD for any file-types you want.

    Just Check The \SAMPLES Directory.

    Lior, An Israeli Programmer.

  4. #4
    Addicted Member jcouture100's Avatar
    Join Date
    Aug 1999
    Posts
    141
    I don't have the sample programs installed (conserving hard disk space ), so I'll have to take Lior's word on it.

    However, if the sample program uses the "DIR" function to do a recursive search you will find that the speed is pretty poor compared to the API version given in the VB World Tip.

    As for me... I'm a fan of using API calls when they are available. They usually perform better and I want my apps to be as efficient as possible.
    JC

  5. #5
    Registered User Lior's Avatar
    Join Date
    Jan 2000
    Posts
    307

    Cool

    Well...
    As far as I know, the sample uses neither the DIR build-in function, nor any API function.
    If you know the Turbo Pascal language, It uses something close to the FindFirst & FindNext procedures.

    Lior, An Israeli Programmer.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Leeds, UK
    Posts
    287

    Thumbs up

    Thank you both for your help. I'm also a fan of API functions.
    rino_2
    Visual Basic, HTML
    Please Visit my Site: Richard's VB Site

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width