IPortableDevice::Advise method (portabledeviceapi.h)

The Advise method registers an application-defined callback that receives device events.

Syntax

HRESULT Advise(
  [in]  const DWORD                  dwFlags,
  [in]  IPortableDeviceEventCallback *pCallback,
  [in]  IPortableDeviceValues        *pParameters,
  [out] LPWSTR                       *ppszCookie
);

Parameters

[in] dwFlags

DWORD that specifies option flags.

[in] pCallback

Pointer to a callback object.

[in] pParameters

This parameter is ignored and should be set to NULL.

[out] ppszCookie

A string that represents a unique context ID. This is used to unregister for callbacks when calling Unadvise.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK
The application-defined callback was successfully registered.

Requirements

Requirement Value
Target Platform Windows
Header portabledeviceapi.h
Library PortableDeviceGUIDs.lib

See also

Handling Events from the Device

IPortableDevice Interface