IPortableDevice::Advise method

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

dwFlags [in]

DWORD that specifies option flags.

pCallback [in]

Pointer to a callback object.

pParameters [in]

This parameter is ignored and should be set to NULL.

ppszCookie [out]

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 codeDescription
S_OK

The application-defined callback was successfully registered.

 

Examples

For an example of how to use this method, see Handling Events from the Device.

Requirements

Header

PortableDeviceApi.h

Library

PortableDeviceGUIDs.lib

See also

Handling Events from the Device
IPortableDevice Interface

 

 

Community Additions

ADD
Show: