Display the Windows Disconnect Network Drive dialog box #175

This code shows how to display the Windows Disconnect Network Drives dialog box.

If the user clicks OK the selected network drive is disconnected and True is returned. If the user cancels or there is an error False is returned. OwnerHandle is the handle of the window that owns the dialog box.

function DisconnectNetworkDriveDialog(const OwnerHandle: THandle): Boolean;
begin
  Result := WNetDisconnectDialog(
    OwnerHandle, RESOURCETYPE_DISK
  ) = NO_ERROR;
end;
Author: Unknown
Contributor: Shlomo Abuisak
Added: 2010/12/17
Last updated: 2010/12/17