次の方法で共有


IObexDevice::Connect (Compact 2013)

3/26/2014

This method initiates an Object Exchange (OBEX) Protocol transaction with a specific remote device.

Syntax

HRESULT Connect(
  LPCWSTR pszPassword,
  DWORD dwCapability,
  IHeaderCollection* pHeaders
);

Parameters

  • pszPassword
    [in] Password for the connection (optional). If a password is unnecessary, set this parameter to NULL.
  • dwCapability
    [in] Reserved. Set to 0.
  • pHeaders
    [in] Points to the header list that may provide the server with additional information. For example, if the list contains the Target header, then the client can use it retrieve the UUID of the server. If the Target header is not included in the list, then the connection is made to the default service, Inbox Server.

Return Value

This method returns one of the following values.

Return value

Description

S_OK

The connection was established successfully.

E_FAIL

The connection was unsuccessful.

OBEX_E_CONNECTION_NOT_ACCEPTED

The authentication was unsuccessful. The password is most likely incorrect.

Remarks

If a password is not specified in pszPassword and the server requires a password, a callback is made to the interface registered on the main OBEX object. If no interface is registered for callbacks and a password is required, the method returns an error. If the password is not specified, this method uses the password specified in IObexDevice::SetPassword.

Note

This method does not make the connection but it sends a new CONNECT packet. The physical transport might already exist and be reused.

To connect to a custom service, refer to that service using its associated GUID.

Requirements

Header

obex.h,
obex.idl

Library

uuid.lib

See Also

Reference

IObexDevice
IObexDevice::SetPassword
OBEX Interfaces