View Full Version : MemorySnapTimeout

July 2, 2006, 09:47:13
I need to snap images at request.
(the time between frames is important for me so im not using the imageavailable event.)
i'v set the display mode to false.
and the MemorySnapTimeout to -1.
however when i call MemeorySnaImage i sometime get the error msg:

"the timeout passed to snapImages(...) did elaps before all images could be snaped"

can u help me

Stefan Geissler
July 3, 2006, 16:03:25

Even if MemorySnapTimeout has been set to -1, it is possible, that a timeout occurs. This happens, if LiveStart has not been called previously. To avoid a debug exception, an error handler should be implemented. The following code sample is for Visual Basic 6.

The following function implements the MemorySnapImage and an error handler. It returns true, if an image could be snapped and false, if some error has occurred:

Private Function SnapImage() As Boolean
On Error GoTo snaperror
SnapImage = True
Exit Function
SnapImage = False
End Function

This function should be called in a little frame work, that reacts on errors:

Private Sub TryToSnapAnImage()
Dim Tries As Integer

Tries = 0
While SnapImage() = False And Tries < 3
Tries = Tries + 1
Debug.Print "Snap Images failed", Tries

If Tries >= 3 Then
MsgBox "I was not able to snap an Image."
End If
End Sub

It uses an integer variable "Tries" to count the tries of snapping an image. In the "While" loop the "SnapImage" function is called the the result is to be evaluated. If it is false, the number of tries is incremented and "SnapImage" is called again. If 3 tries failed, a message box is displayed and your program should handle this problem, e.g. restart the camera by a call to LiveStop and LiveStart.
The timeout problem can be reduced, if LiveStart has been called previously somewhere in the program.

July 13, 2006, 11:19:52
thanks for the reply.
LiveStart has been called previously
LiveDisplay was set to false
and the ring buffer is 2

and i still got the timeout error

Stefan Geissler
July 13, 2006, 14:08:50

In this case, i suggest to call LiveStop and LiveStart in the error handler

While SnapImage() = False And Tries < 3
Tries = Tries + 1
Debug.Print "Snap Images failed", Tries

This costs some time but i guess this avoid the timeout error.