by SreeHarsha (2 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Mon 4th November 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Shows how to format a drive using API calls.
API Declarations
Const SHFD_CAPACITY_360 = 3 ' 360KB, applies to 5.25" drives only
Const SHFD_CAPACITY_720 = 5 ' 720KB, applies to 3.5" drives only
Const SHFD_FORMAT_QUICK = 0 ' quick format
Const SHFD_FORMAT_FULL = 1 ' full format
Const SHFD_FORMAT_SYSONLY = 2 ' copies system files only (Win95 Only!)
Private Declare Function SHFormatDrive Lib "shell32" (ByVal hwndOwner As Long, ByVal iDrive As Long, ByVal iCapacity As Long, ByVal iFormatType As Long) As Long
'iDrive = The drive number to format. Drive A=0, B=1 (if present, otherwise C=1), and so on.
'iCpacity = One of the first 3 constants
'iFormatType = One of the last 3 constants
SHFormatDrive Me.hwnd, 0, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_QUICK
End Sub
'For more info mail me at [email protected]