Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
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 WNetAddConnection3function.
- 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 lpRemoteNameparameter. 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 lpLocalNameparameter is invalid. |
ERROR_NOT_CONNECTED |
The network resource specified by lpLocalNameis not currently connected and is not a persistent connection. |
ERROR_MORE_DATA |
The lpRemoteNamebuffer is too small. The lpnLengthparameter 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 lpLocalNameis not currently connected and is a persistent connection. |
ERROR_NO_NETWORK |
No network is present. |
Remarks
The WNetGetConnectionfunction 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 |
Windows Mobile | Windows Mobile Version 5.0 and later |