ICImagingControl.ImageAvailable Event

This event is called each time a frame has been copied completely to the internal ring buffer.
Syntax:
Private Sub ImageAvailable(BufferIndex As Long)
Parameter Description
BufferIndex

Specifies the index to an image buffer in the ring buffer for which the event is called.

Limitations:

Before the ImageAvailable event will be fired, ICImagingControl.LiveCaptureContinuous must be set to True, the control must run in live mode and an event sink has to be registered (which is done by Visual Basic).

Remarks:

Inside an event procedure no Windows API functions should be called which cause a SendMessage (i.e. adding text to an edit box) because this may block the application.

While an event procedure is running, no new events are sent, but frames are still copied.

Exceptions that occur in the ImageAvailable event will get lost in the system. Therefore, bugs in the code that cause an exception cannot be recognized. To avoid this, use an On Error Goto ... statement. The On Error Goto ... statement should be put at the beginning of the event handler.If you need to display error messages, do not use a message box. Use a "debug trace" instead (e.g. Debug.Print ... ). This is very important, because otherwise the system may run into a deadlock which will cause the application to hang.

Sample:

This example implements an event procedure for the ImageAvailable event. In the event procedure an ImageBuffer ojbect is declared, which is used to take the image, for that the event has been called.

Private Sub ICImagingControl1_ImageAvailable(ByVal BufferIndex As Long)
    Dim DisplayBuffer As ImageBuffer
    Set DisplayBuffer = ICImagingControl1.ImageBuffers.Item(BufferIndex)
    ICImagingControl1.DisplayImageBuffer DisplayBuffer
End Sub

See the Displaying Buffers on the ImageAvailable Event example.

See also: ICImagingControl, ICImagingControl.LiveCaptureContinuous

<< ICImagingControl