Share via


WNetGetConnection (Windows Embedded CE 6.0)

1/6/2010

This function retrieves the remote name of the network resource associated with a local name.

Syntax

DWORD WNetGetConnection( 
  LPCTSTR lpLocalName, 
  LPTSTR lpRemoteName, 
  LPDWORD lpnLength 
);

Parameters

  • lpLocalName
    [in] Long pointer to a null-terminated string that specifies the local name of the network resource. Set up this resource with the WNetAddConnection3 function.
  • lpRemoteName
    [out] Long pointer to a buffer that receives the null-terminated remote name used to make the connection.
  • lpnLength
    [in, out] Long pointer to a variable that specifies the size, in characters, of the buffer pointed to by the lpRemoteName parameter. If the function fails because the buffer is not big enough, this parameter returns the required buffer size.

Return Value

ERROR_SUCCESS indicates success. An error value indicates failure.

Value Description

ERROR_BAD_DEVICE

The string pointed to by the lpLocalName parameter is invalid.

ERROR_NOT_CONNECTED

The network resource specified by lpLocalName is not currently connected and is not a persistent connection.

ERROR_MORE_DATA

The lpRemoteName buffer is too small. The lpnLength parameter points to a variable that contains the required buffer size. More entries are available with subsequent calls.

ERROR_CONNECTION_UNAVAIL

The network resource specified by lpLocalName is not currently connected and is a persistent connection.

ERROR_NO_NETWORK

No network is present.

Remarks

The WNetGetConnection function can be used to obtain information about network resources, such as printers.

Requirements

Header winnetwk.h
Library coredll.lib
Windows Embedded CE Windows CE 2.0 and later

See Also

Reference

Windows Networking API/Redirector Functions
WNetAddConnection3