Drive.Eject

Drive.Eject ( 

string Drive )

Example 1

Drive.Eject(_SourceDrive);

Ejects the CD/DVD-ROM drive the installation is currently running from.

Note: _SourceDrive is a built-in variable that contains the drive letter where the setup.exe file is located.

Example 2

Drive.Eject(_SourceFolder);

Ejects the CD/DVD-ROM drive the installation is currently running from.

Note: _SourceFolder is a built-in variable that contains the path to the folder where the setup.exe file is located.

Example 3

-- Eject the current drive.
Drive.Eject(_SourceFolder);

-- Determine if an error occurred.
error = Application.GetLastError();

-- If an error occurred, display the error message.
if (error ~= 0) then
    result = Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
end

Ejects the CD/DVD-ROM drive the installation is currently running from. If an error occurs, the error code message is shown in a dialog message.

Note: _SourceFolder is a built-in variable that contains the path to the folder where the setup.exe file is located.

Example 4

-- Get the type of the drive where the installation is running from.
drive_type = Drive.GetType(_SourceDrive);

-- If the drive type is a CD/DVD ROM drive, eject it.
if (drive_type == DRIVE_CDROM) then
    Drive.Eject(_SourceDrive);
end

Determines what type of drive the installation is run from and stores the result in drive_type. If the user is running it from a CD-ROM or DVD-ROM drive the drive would be ejected.

Note: _SourceDrive is a built-in variable that contains the drive letter where the setup.exe file is located.

See also:  Related Actions