Private Sub FormatDisk(ByVal options As Long)
Dim drive_letter As String
Dim drive_num As Long
Dim status As Long
drive_letter = UCase$(Left$(txtDrive.Text, 1))
drive_num = Asc(drive_letter) - Asc("A")
status = SHFormatDrive(hWnd, _
drive_num, 0, options)
Select Case status
Case -1
MsgBox "Format failed. User pressed Close."
Case -2
MsgBox "Format canceled. User pressed Close."
Case -3
MsgBox "Unable to format this disk."
Case 6
MsgBox "Disk formatted."
Case Else
MsgBox "Unknown return status " & _
Format$(status)
End Select
End Sub
|