How to Disconnect Network Drive
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 'Network - How to Disconnect Network Drive Option Explicit Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal _ lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long Public Function DisconnectIt(ByVal sDriveLetter As String, _ Optional ByVal bDisconnectOpenFiles As Boolean = True) 'Inputs - sDriveLetter - Drive letter which needs to be disconnected ' bDisconnectOpenFiles - whether to disconnect the drive if there are files open on it. ' - True - disconnect the drive if there are files opened ' - False - not to disconnect the drive if the files are opened 'Returns - True - if Drive is disconnected ' False - if Drive is not disconnected 'Usage - MsgBox DisconnectIt("Q:", True) DisconnectIt = WNetCancelConnection(sDriveLetter, bDisconnectOpenFiles) End Function |
Related posts:
- How to Connect Network Drive
- How to Set Volume Name for given Drive letter
- How to List Network Computers
- How to use Net send to send message from one system to another system in Windows Network.
- How to Get the list of all SQL Servers in the Network
- How to Enumerate user accounts on network
- Get Time and Date of a Network machine Server or Workstation
- How to Return Volume Name for given Drive letter
- How to determine free disk drive space over network?
- How to return the drive type