Does anyone know of a way to format a disk (specifically a floppy) from within VB?
TIA
Printable View
Does anyone know of a way to format a disk (specifically a floppy) from within VB?
TIA
Sure! You can use undocumented SHFormatDrive API.
Usage: FormatDrive DriveToFormatCode:Private Declare Function SHFormatDrive Lib "shell32" (ByVal hwnd As Long, ByVal Drive As Long, ByVal fmtID As Long, ByVal options As Long) As Long
Public Sub FormatDrive(pstrDriveLetter As String)
Dim intDriveNumber As Integer
'This is for the second parameter
'drive number: A: is 0, B: is 1 and so on...
intDriveNumber = UCase(Asc(pstrDriveLetter)) - 65
Call SHFormatDrive(Me.hwnd, intDriveNumber, 0, 0)
End Sub
Example: Call FormatDrive("a:")
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 12-06-1999).]