WNetCancelConnection

3.1

  UINT WNetCancelConnection(lpszName, fForce)    
  LPSTR lpszName; /* address of device or resource */
  BOOL fForce; /* forced closure flag, */  

The WNetCancelConnection function cancels a network connection.

Parameters

lpszName

Points to the name of the redirected local device (such as LPT1 or D:).

fForce

Specifies whether any open files or open print jobs on the device should be closed before the connection is canceled. If this parameter is FALSE and there are open files or jobs, the connection should not be canceled and the function should return the WN_OPEN_FILES error value.

Return Value

The return value is one of the following:

Value Meaning

WN_SUCCESS The function was successful.
WN_NOT_SUPPORTED The function was not supported.
WN_OUT_OF_MEMORY The system was out of memory.
WN_NET_ERROR An error occurred on the network.
WN_BAD_POINTER The pointer was invalid.
WN_BAD_VALUE The lpszName parameter was not a valid local device or network name.
WN_NOT_CONNECTED The lpszName parameter was not a redirected local device or currently accessed network resource.
WN_OPEN_FILES Files were open and the fForce parameter was FALSE. The connection was not canceled.

See Also

WNetAddConnection, WNetGetConnection