Compartilhar via


IRemoteToolServer::ConnectToDevice (Compact 2013)

3/26/2014

When called, this method establishes a connection to a device, and returns an instance of IRemoteToolDevice.

You can either specify the ID of the device to connect, or show a modal device selection dialog to allow the user to choose a device to which to connect.

Syntax

HRESULT ConnectToDevice([in] DWORD_PTR hwndParent, [in] BSTR bstrDeviceID, [out] IRemoteToolDevice **ppRemoteToolDevice)

Parameters

  • hwndParent
    The window to set as the parent of the modal device selection dialog, if bstrDeviceID is set to NULL.
  • bstrDeviceID
    The ID of the device to which to connect. For more information, see IRemoteToolDeviceDataStore::GetDeviceID.

    If you want to allow the user to choose a device interactively, set this to NULL.

  • ppRemoteToolDevice
    An instance of IRemoteToolDevice associated with the device that is returned upon a successful connection.

Return Value

E_INVALIDARG if ppRemoteToolDevice is NULL.

ERROR_INVALID_DATA if Core Connectivity has not been initialized by calling IRemoteToolServer::Initialize.

RT_ERROR_NODEVICE (0x800400003) if Remote Tool Server could not connect to the device or the user cancelled the operation.

RT_ERROR_NOCCCONNECT (0x800400004) if the device selection dialog COM server could not be instantiated.

E_OUTOFMEMORY if the desktop is in a low memory condition.

S_OK if success.

See Also

Reference

IRemoteToolServer
IRemoteToolDeviceDataStore::GetDeviceID
IRemoteToolServer::Initialize