The IWiaDevMgr2::RegisterEventCallbackCLSID method registers an application to receive events even if the application is not 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]
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]
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]
Specifies the name of the application that registers for the event.
- bstrDescription [in]
Specifies a text description of the application that registers for the event.
- bstrIcon [in]
Specifies the name of an image file to use for the icon for the application that registers for the event.
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
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.
Minimum supported client
|Windows Vista [desktop apps only]|
Minimum supported server
|Windows Server 2008 [desktop apps only]|