I am writing a program to interface with a Motion Cam. I want the form to just sit there and wait until a file exists in the webcam directory (lookout.jpg). I also want to be able to interact with the form while waiting for the file (to change options etc).
This is the best I have come up with:
----------------------------------------------------------------------
Sub CheckForFile()
Application.DoEvents()
If System.IO.File.Exists(strLookoutPath) Then
PictureIsPresent()
End If
System.Threading.Thread.Sleep(500)
CheckForFile()
End Sub
-----------------------------------------------------------------------
This works, but-
1) I would like to get rid of the 500ms delay
2) After a few hours, the program exits (did I read somewhere that a Loop can only run a limited number of times?)
Thanks in advance...
p.s. This forum is incredible!!!!
This is the best I have come up with:
----------------------------------------------------------------------
Sub CheckForFile()
Application.DoEvents()
If System.IO.File.Exists(strLookoutPath) Then
PictureIsPresent()
End If
System.Threading.Thread.Sleep(500)
CheckForFile()
End Sub
-----------------------------------------------------------------------
This works, but-
1) I would like to get rid of the 500ms delay
2) After a few hours, the program exits (did I read somewhere that a Loop can only run a limited number of times?)
Thanks in advance...
p.s. This forum is incredible!!!!
Last edited: