The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: elmo on April 12, 2011, 03:50:20 AM

Title: speed up findfirst/ findnext
Post by: elmo on April 12, 2011, 03:50:20 AM
I usually list a file from a spesific directory (Example: C:\) with API FindFirstFile & FindNextFile in a looping.

But, this API will works slowly if I want to list a file from a directory (Example: C:\folder1\ who has > 1000 files in it).
As the result, the user will wait for a seconds until API FindNextFile arrive at the end of the file from that directory.
And this waiting time will annoyed for the impatient user. :lol

how to solve this?
would you like to share me a clue?
thank you.
best regards,
Title: Re: speed up findfirst/ findnext
Post by: hutch-- on April 12, 2011, 03:53:35 AM
Elmo,

One trick is to turn off the list of listview dispay while you are loading it. Reduces the time to scan the whole directory. You are basically limited to disk IO speed in a task like this so there may not be any really fast alternatives to what you are doing.


  ; before the scan

    fn  LoadCursor,NULL,IDC_WAIT
    fn SetCursor,eax

    fn SendMessage,hlview,WM_SETREDRAW,FALSE,0



  ; after the scan
    fn SendMessage,hlview,WM_SETREDRAW,TRUE,0