IC Imaging Control C++

Grabber::addListener Method

Grabber::addListener Method

This method registers a callback handler object for the specified events.
void addListener( GrabberListener* pListener, DWORD callback = -1 );
Parameter Description

Specifies a pointer to the callback handler object that is to be registered. The callback handler object has to be derived from GrabberListener.


Specifies the events that will be handled by the object referred to by pListener. A combination of GrabberListener::tListenerTypes specifies the events. A binary OR is used to combine two or more listener types. It defaults to -1. -1 is the combination of all possible GrabberListener::tListenerTypes.


This method is used to add a GrabberListener object to an internal list of the grabber. If one of the events occur that is defined by GrabberListener::tListenerType, the grabber calls the callback methods of all listener objects in the list that were added for this event. One GrabberListener object may handle more than one event. The parameter callback specifies the set of events that will be handled by the listener object. For possible values of callback, refer to GrabberListener::tListenerType. For more informations about callbacks, refer to GrabberListener.

The GrabberListener::frameReady method will be called, if the sink is a FrameHandlerSink and snap mode is set to false or snap mode is set to true and FrameHandlerSink::snapImages was called.

The GrabberListener::frameReady method will only be called, if a MemBufferCollection is used. To do so, create and set a FrameHandlerSink with at least one image buffer.


For an example of how to use the addListener method, see Using a Callback Function.

See also: Grabber, Grabber::removeListener, Grabber::isListenerRegistered, GrabberListener, GrabberListener::tListenerType, GrabberListener::frameReady, FrameHandlerSink, FrameHandlerSink::create, FrameHandlerSink::setSnapMode

<< Grabber

Get in touch with us

About The Imaging Source

Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, video converters and embedded vision components for factory automation, quality assurance, medicine, science, security and a variety of other markets.

Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE, MIPI interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.

ISO 9001:2015 certified MVTEC | Edge AI + Vision Alliance | EMVA

Contact us