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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Procedure as Interrupt or similar. CPU cycles / time issue

Status
Not open for further replies.

Caradog

Programmer
Jun 28, 2000
73
GB
I have a problem with my program. Looking around the posts here I have some ideas, but nothing solid in my mind yet.

I have a function that is continously scanning a folder for new file additions. When it finds one it converts the file, moves it and waits for another.

Obviously, just the scanning of the directory is eating up a hell of a lot of CPU cycles continously so I wanted to check the directory every 2, 4 or 6 seconds, which ever works best.

The sleep lib (kernel32) solutions sounds OK but I was wondering if anyone had examples of this kind of "putting the the breaks on" in a continously running function.

Here's an snippit of my code:

While Complete <> &quot;OK&quot;
findFile = Dir(strFile + &quot;*.doc&quot;)

<i>...if found do conversion & save file elsewhere...</i>

'Move original file out of scanned folder
FileCopy &quot;E:\PDF\inbox\&quot; + findFile, &quot;E:\PDF\outbox\&quot; + findFile
Kill &quot;E:\PDF\inbox\&quot; + findFile
Wend

Thanks. Jace Hayman
jace@swig-online.co.uk
 
try using a timer an set the interval value to 2000, 4000 or 6000.

when you get a timer event, set the enabled property to false, look for your file and process accordingly.

when your done set the enabled property back to true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top