Important: The information in this document is obsolete and should not be used for new development.
DIBadMount
To respond to the user's insertion of an uninitialized or damaged disk, you can call theDIBadMount
function.
FUNCTION DIBadMount (where: Point; evtMessage: LongInt): Integer;
where
- The desired location, in global coordinates, of the upper-left corner of the disk initialization dialog box. In system software versions 7.0 and later, this parameter is ignored, and the dialog box is automatically centered on the screen.
evtMessage
- The event message received when the disk is inserted. The high word of this message contains the result code associated with the disk insertion. The low word of this message indicates the number of the drive into which the user inserted the disk.
DESCRIPTION
TheDIBadMount
function evaluates the result code in the high word of theevtMessage
parameter and responds appropriately. If the result code isnoErr
, the function allows
the user to erase the contents of the disk. If the result code isioErr
,badMDBErr
, ornoMacDskErr
, initializing the disk might correct the problem, and soDIBadMount
displays a dialog box that explains the problem and allows the user to initialize the disk. If the result code isextFSErr
,memFullErr
,nsDrvErr
,paramErr
, orvolOnLinErr
, then initializing the disk would not correct the problem. In this case,DIBadMount
ejects the disk from the drive and returns the result code.Before presenting the disk initialization dialog box,
DIBadMount
checks whether the drive contains an already mounted volume. If so, it ejects the disk and returns 2 as its result. This happens rarely and could reflect an error in your application (for example, you forgot to callDILoad
, and the user had to switch to the disk containing the System resource file).The
DIBadMount
function uses just one disk initialization dialog box to cover all disk initialization situations. The dialog box contains many dialog items, which are hidden and shown as appropriate. The dialog box always contains an icon indicating the drive containing the disk to be initialized.The initial text of the disk initialization dialog box depends on the result code received. For example, if you pass
noMacDskErr
toDIBadMount
in theevtMessage
parameter, the dialog box displays the text "This is not a Macintosh disk." If you pass the result
codenoErr
, you can customize the message by using the Dialog Manager'sParamText
procedure.The disk initialization dialog box contains a button allowing the user to cancel the initialization and one or two buttons allowing the user to request initialization of
the disk. Usually, the cancel button is labeled Eject, but if the result code passed toDIBadMount
within theevtMessage
parameter isnoErr
, then the cancel button is labeled Cancel. If the user responds to the disk initialization dialog box by clicking
the Eject button,DIBadMount
ejects the disk and returns 1 as its result. If the user
clicks the Cancel button,DIBadMount
returns 1 but does not eject the disk.In most cases, the Initialize button is the only alternative to the Eject or Cancel button. However, if the user inserts a double-sided (but not high-density) disk into a double-sided or high-density disk drive,
DIBadMount
presents buttons labeled One-Sided and Two-Sided. The user can then decide whether to make the disk single-sided or double-sided. If the user clicks the Initialize button, the One-Sided button, or the Two-Sided button,DIBadMount
warns the user that the initialization process erases any existing data on the disks. If the user proceeds,DIBadMount
allows the user to name the disk if it is not already named and then updates the text of the dialog box to inform the user of the progress of the operation. If the operation fails,DIBadMount
alerts the user and ejects the disk, returning an appropriate result code.You can use
DIBadMount
to format hard disks as well as floppy disks. However, you should not attempt to format the startup volume.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector forDIBadMount
are
Trap macro Selector _Pack2 $0000 SPECIAL CONSIDERATIONS
Because theDIBadMount
function might allocate memory, you should not call it at interrupt time.RESULT CODES