Platform SDK: Network Management

NetUseDel

The NetUseDel function ends a connection to a shared resource.

Win32-based applications can also use the WNetCancelConnection2 function to terminate a network connection.

Security Requirements

No special group membership is required to call the NetUseDel function. This function cannot be executed on a remote server.

NET_API_STATUS NetUseDel (
  LPWSTR UncServerName,  
  LPWSTR UseName,        
  DWORD ForceCond        
);

Parameters

UncServerName
[in] Reserved; must be NULL.
UseName
[in] Pointer to a Unicode string specifying the path of the connection to delete.
ForceCond
[in] Specifies the level of force to use in deleting the connection. This parameter can be one of the following values.
Value Meaning
USE_NOFORCE Fail the disconnection if open files exist on the connection.
USE_FORCE Fail the disconnection if open files exist on the connection.
USE_LOTS_OF_FORCE Close any open files and delete the connection.

Return Values

If the function succeeds, the return value is NERR_Success.

If the function fails, the return value is a Win32 API error code. For a list of error codes, see Error Codes.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Unsupported.
  Header: Declared in Lmuse.h; include Lm.h.
  Library: Use Netapi32.lib.

See Also

Network Management Overview, Network Management Functions, Use Functions, NetUseAdd, WNetCancelConnection2