IWiaDevMgr::RegisterEventCallbackInterface method (wia_xp.h)

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

Syntax

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

Parameters

[in] lFlags

Type: LONG

Currently unused. Should be set to zero.

[in] bstrDeviceID

Type: BSTR

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

[in] pEventGUID

Type: const GUID*

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

[in] pIWiaEventCallback

Type: IWiaEventCallback*

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

[out] pEventObject

Type: IUnknown**

Receives the address of a pointer to the IUnknown interface.

Return value

Type: HRESULT

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

Remarks

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 examining 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.
 

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header wia_xp.h (include Wia.h)
Library Wiaguid.lib
DLL Wiaservc.dll