IPortableDeviceService::Advise method (portabledeviceapi.h)

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

Syntax

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

Parameters

[in] dwFlags

Not used.

[in] pCallback

The IPortableDeviceEventCallback interface specifying the callback object to register.

[in] pParameters

The IPortableDeviceValues interface specifying the event-registration parameters, or NULL if the callback object is to receive all service events.

[out] ppszCookie

The unique context ID for the callback object. This value matches that used by the Unadvise method to unregister the callback object.

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 method succeeded.
E_POINTER
A NULL value was specified for the pCallback parameter or the ppszCookie parameter.

Remarks

During cleanup, an application should unregister the callback object by calling the Unadvise method, and then release the memory referenced by the ppszCookie parameter by calling the CoTaskMemFree function.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps | UWP apps]
Minimum supported server None supported
Target Platform Windows
Header portabledeviceapi.h

See also

IPortableDeviceService Interface