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 theDIBadMountfunction.
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
TheDIBadMountfunction evaluates the result code in the high word of theevtMessageparameter 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 soDIBadMountdisplays 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,DIBadMountejects the disk from the drive and returns the result code.Before presenting the disk initialization dialog box,
DIBadMountchecks 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
DIBadMountfunction 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
noMacDskErrtoDIBadMountin theevtMessageparameter, 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'sParamTextprocedure.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 toDIBadMountwithin theevtMessageparameter isnoErr, then the cancel button is labeled Cancel. If the user responds to the disk initialization dialog box by clicking
the Eject button,DIBadMountejects the disk and returns 1 as its result. If the user
clicks the Cancel button,DIBadMountreturns 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,
DIBadMountpresents 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,DIBadMountwarns the user that the initialization process erases any existing data on the disks. If the user proceeds,DIBadMountallows 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,DIBadMountalerts the user and ejects the disk, returning an appropriate result code.You can use
DIBadMountto 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 forDIBadMountare
Trap macro Selector _Pack2 $0000 SPECIAL CONSIDERATIONS
Because theDIBadMountfunction might allocate memory, you should not call it at interrupt time.RESULT CODES