Rediger

Del via


IWiaDevMgr2::RegisterEventCallbackCLSID method

The IWiaDevMgr2::RegisterEventCallbackCLSID method registers an application to receive events even if the application is not running.

Syntax

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
);

Parameters

lFlags [in]

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.

 

bstrDeviceID [in]

Type: BSTR

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

pEventGUID [in]

Type: const GUID*

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

pClsID [in]

Type: const GUID*

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

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 use 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 2.0 applications use this method to register to receive hardware device events. After IWiaDevMgr2::RegisterEventCallbackCLSID is called, the application is registered to receive WIA 2.0 device events even if it is not running.

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

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

If the application is not a registered Component Object Model (COM) component and is not compatible with the WIA 2.0 architecture, use the IWiaDevMgr2::RegisterEventCallbackProgram method to register an application for device events.

Note

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

 

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
Header
Wia.h