IWiaDevMgr::RegisterEventCallbackCLSID method

The IWiaDevMgr::RegisterEventCallbackCLSID method registers an application to receive events even if the application may not be running.


HRESULT RegisterEventCallbackCLSID(
  [in]               LONG lFlags,
  [in]               BSTR bstrDeviceID,
  [in]         const GUID *pEventGUID,
  [in, unique] const GUID *pClsID,
  [in]               BSTR bstrName,
  [in]               BSTR bstrDescription,
  [in]               BSTR bstrIcon


lFlags [in]

Type: LONG

Specifies registration flags. Can be set to the following values:

Registration FlagMeaning
WIA_REGISTER_EVENT_CALLBACKRegister for the event.
WIA_UNREGISTER_EVENT_CALLBACKDelete the registration for the event.
WIA_SET_DEFAULT_HANDLERSet the application as the default event handler.


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.

pClsID [in]

Type: const GUID*

Pointer to the application's class ID (CLSID). The WIA run-time system uses the application's CLSID to start the application when an event occurs for which it is registered.

bstrName [in]

Type: BSTR

Specifies the name of the application that registers for the event.

bstrDescription [in]

Type: BSTR

Specifies a text description of the application that registers for the event.

bstrIcon [in]

Type: BSTR

Specifies the name of an image file to be used for the icon for the application that registers for the event.

Return value


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


WIA applications use this method to register to receive hardware device events of the type WIA_ACTION_EVENT. Once programs call IWiaDevMgr::RegisterEventCallbackCLSID, they are registered to receive WIA device events even if they are not running.

When the event occurs, the WIA system determines which application is registered to receive the event. It uses the CoCreateInstance function and the class ID specified in the pClsID parameter to create an instance of the application. It then calls the application's ImageEventCallback method to transmit the event information.

An application can invoke the EnumRegisterEventInfo method to enumerate event registration information.

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.

If the application is not a registered Component Object Model (COM) component and is not compatible with the WIA architecture, developers should use IWiaDevMgr::RegisterEventCallbackProgram instead of this 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]