IWiaDevMgr2::RegisterEventCallbackInterface method

Registers a running application for Windows Image Acquisition (WIA) 2.0 event notification.


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


lFlags [in]

Type: LONG

Currently unused. Should be set to zero.

bstrDeviceID [in]

Type: BSTR

Specifies the unique identifier of a WIA 2.0 device. Set this parameter to NULL to register for the event on all WIA 2.0 devices.

pEventGUID [in]

Type: const GUID*

Specifies a pointer to the event identifier that the application is registering for. See WIA Event Identifiers for standard event identifiers.

pIWiaEventCallback [in]

Type: IWiaEventCallback*

Specifies a pointer to the IWiaEventCallback interface that the WIA 2.0 uses to send event notification.

pEventObject [out]

Type: IUnknown**

Receives the address of a pointer to the IUnknown interface.

Return value


Returns the standard COM error codes or the following.

Return codeDescription

The IUnknown interface cannot be returned.



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 WIA 2.0 applications begin executing, they use this method to register to receive hardware device events. This prevents the application from being restarted when another event for which it is registered occurs. Once an application calls IWiaDevMgr2::RegisterEventCallbackInterface to register itself to receive WIA 2.0 events from a device, the registered events are routed to the program by WIA 2.0.

Applications must call the IUnknown::Release method on the interface pointers they receive through the pEventObject parameter.

Note  In a multithreaded application, the event notification callback may come in on a different thread from the one that registered the callback.


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]