Xceed Zip Compression Library Documentation
InsertDisk event
Xceed Zip control reference > Xceed Zip control events > InsertDisk event

The InsertDisk event is triggered whenever a new or different disk is required to be inserted in a drive so that the current operation on a spanned zip file can proceed.

When using the Zip method and the SpanMultipleDisks property is set to span disks, this event is triggered when the current disk being written to gets full. This event allows you to prompt the end-user to insert a new disk. The lDiskNumber parameter provides the number of the current disk being requested. After the user has been queried to insert a new disk, the bDiskInserted parameter, which is modifiable, must be set to True. If it is left to the default value of False, the zipping operation will be aborted. Your application should inform the user to label each disk with the appropriate disk number as soon as it has been filled. If the same disk is still in the drive after the bDiskInserted parameter has been set to True and the InsertDisk event has completed, the InsertDisk event will be triggered again.

If the target disk is write-protected or the drive is empty, an InsertDisk event is also triggered, with lDiskNumber set to 0. This means the target drive cannot be written to.

When using the Unzip, ListZipContents or TestZipFile methods and a spanned zip file is being read, this event will be triggered whenever data must be read from a disk in the disk set other than the one currently in the drive. The nDiskNumber parameter provides the number of the current disk being requested. After the user has been queried to insert a new disk, the bDiskInserted parameter, which is modifiable, must be set to True. If it is left to the default value of False, the unzipping, testing or listing operation will be aborted. If the wrong disk is inserted, or the same disk is still in the drive after the bDiskInserted parameter has been set to True and the InsertDisk event has completed, the InsertDisk event will be triggered again.

Example

Visual  Basic  
Private Sub xZip_InsertDisk(ByVal nDiskNumber As Long, bDiskInserted As Boolean)
Dim nAnswer As VbMsgBoxResult

If nDiskNumber = 0 Then
nAnswer = MsgBox("This zip file is part of a multidisk zip file. Please insert the last disk of the set.", vbExclamation + vbOKCancel)
Else
nAnswer = MsgBox("Please insert disk #" & Trim(Str(nDiskNumber)), vbExclamation + vbOKCancel)
End If

bDiskInserted = (nAnswer = vbOK)
End Sub
Delphi  
procedure TfrmMain.xZipInsertDisk(Sender: TObject; nDiskNumber: Integer;
var bDiskInserted: WordBool);
var
nAnswer : Word;
begin
{ When nDiskNumber is 0, this means the last disk of the set is required }
if nDiskNumber = 0 then
nAnswer := MessageDlg( 'This file is part of a multidisk zip file. Please ' +
'insert the last disk of the set.', mtInformation,
[mbOK,mbCancel], 0 )
else
nAnswer := MessageDlg( 'Please insert disk #' + IntToStr( nDiskNumber ) + '.',
mtInformation, [mbOK,mbCancel], 0 );

if nAnswer = mrOK then
bDiskInserted := true;
end;
Declaration  
Event InsertDisk(lDiskNumber As Long, bDiskInserted As Boolean)                    
Declaration (DLL API)  
xcdInsertDiskParams * pParams = ( xcdInsertDiskParams * ) lParam;                    

Parameters

Parameter Description
lDiskNumber  The number of the requested disk. If nDiskNumber = xcdLastDisk (0) then the last disk of the disk set is requested.
bDiskInserted  Set this to True to confirm that you have requested the insertion of the appropriate disk. If you leave it to its default value of False, the current operation will terminate and return xerInsertDiskAbort error.

Applicable methods

Zip, Unzip, ListZipContents, TestZipFile