IC Imaging Control C++

Grabber::isListenerRegistered Method

Grabber::isListenerRegistered Method

This method checks whether the specified callback handler is registered for the specified events.
Syntax:
bool isListenerRegistered( GrabberListener* pListener, DWORD callback = -1 );
Parameter Description
pListener

Specifies a pointer to a GrabberListener callback handler that is to be checked.

callback

Specifies the events to be checked. It can be a combination of GrabberListener::tListenerTypes. To combine two or more listener types, use a binary OR operation. It defaults to -1. -1 is the combination of all available GrabberListener::tListenerTypes.

Return value:

true, if the callback handler is registered for at least one of the specified events. Otherwise, false is returned.

Sample:

This example shows how to register a callback handler that is derived from GrabberListener for a set of events. It shows also how to unregister the object for the events for which it was registered. Finally, it shows how to delete the callback handler object in a safe way.

Grabber *grabber      = new DShowLib::Grabber();
CListener *pcListener = new CListener();    // Create the GrabberListener object.
                                            // CListener is derived from
                                            // GrabberListener.
// Register the pcListener object to the Grabber's GrabberListener objects list.
grabber->addListener( pcListener, DShowLib::GrabberListener::eFRAMEREADY|
                                  DShowLib::GrabberListener::eOVERLAYCALLBACK );
grabber->startLive( true );            // Start the grabber
// Events are handled now
fflush(stdin);
printf("Press [enter] to stop!");
getchar();
// The GrabberListener object must be unregistered for the events
// for which it was registered, before it can be deleted.
// First, unregister it for the frame ready event.
grabber->removeListener(pcListener, DShowLib::GrabberListener::eFRAMEREADY);
// Second, unregister it for the overlay callback event.
grabber->removeListener(pcListener, DShowLib::GrabberListener::eOVERLAYCALLBACK);
// Wait until all remove requests have been processed
while( grabber->isListenerRegistered( pcListener, eALL) )
{
    Sleep( 0 ); // Wait
}
// Now, the application can be sure that the CListener methods
// are no longer called by the Grabber. It is now safe to delete the
// CListener object.
delete pcListener;
grabber->stopLive();            // Stop the grabber
delete grabber;
See also: Grabber, Grabber::addListener, Grabber::removeListener, Grabber::isListenerRegistered, GrabberListener, GrabberListener::tListenerType

<< 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, frame grabbers and video converters for production automation, quality assurance, logistics, medicine, science and security.

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

Automated Imaging Association ISO 9001:2015 certified

Contact us