IPortableDeviceService::Advise method
The Advise method registers an application-defined callback object that receives service events.
Syntax
HRESULT STDMETHODCALLTYPE Advise( [in] const DWORD dwFlags, [in] IPortableDeviceEventCallback *pCallback, [in] IPortableDeviceValues *pParameters, [out] LPWSTR *ppszCookie );
Parameters
- dwFlags [in]
-
Not used.
- pCallback [in]
-
The IPortableDeviceEventCallback interface specifying the callback object to register.
- pParameters [in]
-
The IPortableDeviceValues interface specifying the event-registration parameters, or NULL if the callback object is to receive all service events.
- ppszCookie [out]
-
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 |
|---|---|
|
The method succeeded. |
|
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
|
Minimum supported client | Windows 7 [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server | None supported |
|
Header |
|
|
IDL |
|
See also