Platform SDK: DirectX

IDirectPlay4::GetPlayerAddress

The IDirectPlay4::GetPlayerAddress method retrieves the DirectPlay address for a player.

The DirectPlay address is a network address for a player using a specific service provider. You should call the IDirectPlayLobby3::EnumAddress method to parse the buffer retrieved by IDirectPlay4::GetPlayerAddress.

If this method is called on a local player, it returns the network address of the computer if it is available. In some cases, more than one address can be returned (for example, with TCP/IP where the computer has both a network card and a dial-up Internet connection).

HRESULT GetPlayerAddress(
  DPID idPlayer,
  LPVOID lpData,
  LPDWORD lpdwDataSize
);

Parameters

idPlayer
Player ID that the address is being requested for. Pass in 0 to obtain a list of valid address options for a service provider (for example, a list of valid modem choices for the modem-to-modem service provider).
lpData
Pointer to a buffer where the DirectPlay address is to be written. Set this parameter to NULL to request only the size of data. The lpdwDataSize parameter will be set to the size required to hold the data.
lpdwDataSize
Pointer to a variable that is initialized to the size of the buffer before calling this method. After the method returns, this parameter will be set to the size, in bytes, of the DirectPlay address data. If the buffer was too small, then this parameter will be set to the buffer size that is required and the method will return DPERR_BUFFERTOOSMALL.

Return Values

Returns DP_OK if successful, or one of the following error values otherwise:

DPERR_BUFFERTOOSMALL
DPERR_INVALIDOBJECT
DPERR_INVALIDPARAMS
DPERR_INVALIDPLAYER
DPERR_UNAVAILABLE

This method returns DPERR_UNAVAILABLE if the address for the requested player ID is not available.

Remarks

To get a list of valid modem choices, pass in 0 for the idPlayer parameter. A list of modem choices will be returned as a list of ANSI or Unicode strings with a zero-length string at the end.

The DirectPlay address will contain both ANSI and Unicode strings with the address, regardless of what interface this method is called on.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in dplay.h.
  Import Library: Use dplayx.lib.

See Also

IDirectPlayLobby3::EnumAddress, DirectPlay Address