IPortableDeviceServiceMethods::InvokeAsync method (portabledeviceapi.h)

The InvokeAsync method asynchronously invokes a method.

Syntax

HRESULT InvokeAsync(
  [in] REFGUID                              Method,
  [in] IPortableDeviceValues                *pParameters,
  [in] IPortableDeviceServiceMethodCallback *pCallback
);

Parameters

[in] Method

The method to invoke.

[in] pParameters

A pointer to an IPortableDeviceValues interface that contains the parameters of the invoked method, or NULL to indicate that the method has no parameters.

[in] pCallback

A pointer to an application-supplied IPortableDeviceServiceMethodCallback callback object that receives the method results, or NULL to ignore the method results.

Return value

If the method succeeds, it returns S_OK. Any other HRESULT value indicates that the call failed.

Remarks

When invoking multiple methods, clients can create a separate instance of the IPortableDeviceServiceMethodCallback interface for each invocation, saving a context with that instance object before passing it to the InvokeAsync method. This way, the method operation can be identified when the OnComplete method is called. Use of a unique object for each invocation also allows targeted cancellation of an operation by the Cancel method.

Examples

For an example of how to use this method, see Invoking Service Methods Asynchronously.

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

IPortableDeviceServiceMethods Interface

Invoking Service Methods Asynchronously