IWiaDevMgr::RegisterEventCallbackInterface method

The IWiaDevMgr::RegisterEventCallbackInterface method registers a running application Windows Image Acquisition (WIA) event notification.


HRESULT RegisterEventCallbackInterface(
  [in]               LONG              lFlags,
  [in]               BSTR              bstrDeviceID,
  [in]         const GUID              *pEventGUID,
  [in, unique]       IWiaEventCallback *pIWiaEventCallback,
  [out]              IUnknown          **pEventObject


lFlags [in]

Type: LONG

Currently unused. Should be set to zero.

bstrDeviceID [in]

Type: BSTR

Specifies a device identifier. Pass NULL to register for the event on all WIA devices.

pEventGUID [in]

Type: const GUID*

Specifies the event for which the application is registering. For a list of standard events, see WIA Event Identifiers.

pIWiaEventCallback [in]

Type: IWiaEventCallback*

Pointer to the IWiaEventCallback interface that the WIA system used to send the event notification.

pEventObject [out]

Type: IUnknown**

Receives the address of a pointer to the IUnknown interface.

Return value


If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


Warning  Using the IWiaDevMgr::RegisterEventCallbackInterface, IWiaDevMgr2::RegisterEventCallbackInterface, and DeviceManager.RegisterEvent methods from the same process after the Still Image Service is restarted may cause an access violation, if the functions were used before the service was stopped.

When they begin executing, WIA applications use this method to register to receive hardware device events of the type WIA_NOTIFICATION_EVENT. This prevents the application from being restarted when another event for which it is registered occurs. Once a program invokes IWiaDevMgr::RegisterEventCallbackInterface to register itself to receive WIA events from a device, the registered events are routed to the program by the WIA system.

Applications use the EnumRegisterEventInfo method to retrieve a pointer to an enumerator object for event registration properties.

An application can find whether an event is an action type or notification type (or both) event by examinging the ulFlags value of a WIA_DEV_CAP structure returned by event enumeration.

Applications can unregister for events by using the IUnknown pointer returned through the pEventObject parameter to call the IUnknown::Release method.

Note  In a multi-threaded application, there is no guarantee that the event notification callback will come in on the same thread that registered the callback.


Minimum supported client

Windows 2000 Professional, Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]