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.
A version of this page is also available for
4/8/2010

This function breaks an existing network connection.

Syntax

DWORD WNetCancelConnection2(
  LPTSTR 
lpName, 
  DWORD 
dwFlags, 
  BOOL 
fForce 
);

Parameters

lpName

[in] Long pointer to a null-terminated string that specifies the name of either the local name or the remote network resource to disconnect.

dwFlags

[in] Specifies a bitmask for the connection type. The following values are defined.

Value Description

0

The connection to the remote server is broken; however, no persistent information about the connection is updated.

CONNECT_UPDATE_PROFILE

The system is updated with the information that this is no longer a persistent connection. Disconnecting resources using remote names has no effect on persistent connections.

fForce

[in] Boolean that specifies whether the disconnection should occur even if there are open files or jobs on the connection. If this parameter is FALSE, the function fails if there are open files or jobs.

Return Value

ERROR_SUCCESS indicates success. An error value indicates failure. To get extended error information, call GetLastError. Possible GetLastErrorvalues are described in the following table.

Value Description

ERROR_NOT_CONNECTED

The name specified by the lpNameparameter is not a local or remote network resource, or the system is not currently connected to the device specified by the parameter.

ERROR_OPEN_FILES

There are open files, and the fForceparameter is FALSE.

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
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@systemmanager.forsenergy.ru to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.