--- ---

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;