IWiaDevMgr2::RegisterEventCallbackProgram method

The IWiaDevMgr2::RegisterEventCallbackProgram method registers an application to receive device events. It is primarily provided for backward compatibility with applications that were not written for Windows Image Acquisition (WIA) 2.0.

Syntax

HRESULT RegisterEventCallbackProgram(
  [in]       LONG lFlags,
  [in]       BSTR bstrDeviceID,
  [in] const GUID *pEventGUID,
  [in]       BSTR bstrFullAppName,
  [in]       BSTR bstrCommandlineArg,
  [in]       BSTR bstrName,
  [in]       BSTR bstrDescription,
  [in]       BSTR bstrIcon
);

Parameters

lFlags [in]

Type: LONG

The registration flags. Can be set to the following values.

Value 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

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

pEventGUID [in]

Type: const GUID*

The event that the application is registering for. For a list of valid event GUIDs, see WIA Event Identifiers.

bstrFullAppName [in]

Type: BSTR

The full path name of the application.

bstrCommandlineArg [in]

Type: BSTR

The appropriate command-line arguments for the application.

bstrName [in]

Type: BSTR

The name of the application. The name is displayed to the user when multiple applications register for the same event.

bstrDescription [in]

Type: BSTR

The description of the application. The description is displayed to the user when multiple applications register for the same event.

bstrIcon [in]

Type: BSTR

The icon that represents the application. The icon is displayed to the user when multiple applications register for the same event. The string contains the name of the application and the zero-based index of the icon separated by a comma, for example, "MyApp, 0". There might be more than one icon that represents an application.

Return value

Type: HRESULT

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

Remarks

Use IWiaDevMgr2::RegisterEventCallbackProgram to register for hardware device events. When an event occurs that an application is registered for, the application is launched, and the event information is transmitted to the application.

Use the EnumRegisterEventInfo method to retrieve a pointer to an enumerator object for event registration properties.

Only use the IWiaDevMgr2::RegisterEventCallbackProgram method for backward compatibility with applications not written for the WIA 2.0 architecture. Use the Component Object Model (COM) interfaces provided by the WIA 2.0 architecture for new applications. Specifically, call IWiaDevMgr2::RegisterEventCallbackInterface or IWiaDevMgr2::RegisterEventCallbackCLSID to register a new application for device events.

Typically, this method is called by an install program or a script. The install program or script registers the application to receive WIA 2.0 device events. When the event occurs, the application is started by the WIA 2.0 run-time system.

Requirements

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