IWiaDevMgr::RegisterEventCallbackCLSID method (wia_xp.h)

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

Syntax

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

Parameters

[in] lFlags

Type: LONG

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

Registration Flag Meaning
WIA_REGISTER_EVENT_CALLBACK Register for the event.
WIA_UNREGISTER_EVENT_CALLBACK Delete the registration for the event.
WIA_SET_DEFAULT_HANDLER Set the application as the default event handler.

[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] pClsID

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.

[in] bstrName

Type: BSTR

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

[in] bstrDescription

Type: BSTR

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

[in] bstrIcon

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

Type: HRESULT

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

Remarks

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

Requirements

   
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