FloppyFormat



Private Declare Function SHFormatDrive Lib "shell32" _
(ByVal hwnd As Long, _
ByVal Drive As Long, _
ByVal fmtID As Long, _
ByVal options As Long) As Long

Private Const FORMAT_QUICK = &H0 ' this is used below
Private Const FORMAT_FULL = &H1
Private Const FORMAT_SYSTEM = &H2

Private Sub cmdFormatFloppy_Click()
Dim retVal As Long ' the return value of SHFormatDrive
Dim lngDrive As Long ' the drive number

' SHFormatDrive must return 0 for Drive A

' ASCII code for "A" is 65 , so if we subtract 65 from the result

' of the ASC function we get 0


lngDrive = (Asc("A") - 65) ' Modify to use with other drives

retVal = SHFormatDrive(Me.hwnd, lngDrive, HFFFF, FORMAT_QUICK)

End Sub

(floppyformat.html)- by Paolo Puglisi - Modifica del 25/3/2019