WNetGetConnection
This function retrieves the remote name of the network resource associated with a local name.
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 Values
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
OS Versions: Windows CE 2.0 and later.
Header: Winnetwk.h.
Link Library: Coredll.lib.
See Also
Last updated on Saturday, April 10, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.