Thanks for your repley, David. I like the idea of using the loop. (I have never worked with windows API so I don't know where to start) Say I have a button on the form, called cmdStop. (it sets the timer enabled to false thus stopping the whole process) Is there a way I can tell if that button has been clicked during the while loop? Currently if I click the button the click event doesn't fire until the loop is over. I tried also tried:
DO WHILE DateTime() < tTime + 5
if thisform.cmdStop.gotFocus()
exit
endif
ENDDO
But the gotfocus event was firing all the time.
Thanks!
Chris
>
>Instead of a second timer, try something like this:
>
>*: Found a file, wait 5 seconds to be sure it's complete
>LOCAL tTime
>tTime = DateTime()
>DO WHILE DateTime() < tTime + 5
>ENDDO
>
>
>Or, to save processor time for other programs, you can use the Windows API Sleep().
>
>DECLARE Sleep IN Win32API INTEGER nMilliseconds
>
>Then in your timer event
>
>=Sleep(5000)
>
>See WindowsAPI#12645 in the UT for more information.