
Declaramos la función :
Declare Function SHFormatDrive Lib "shell32" (ByVal hwndOwner As Long, _
ByVal iDrive As Long, ByVal iCapacity As Long, ByVal iFormatType As Long)
As Long
Parameters:
hwndOwner
Handle of the owner window for the dialog box.
iDrive
Value specifying the zero-based system drive index (A = 0, B = 1, etc.).
iCapacity
Value specifying the formatted capacity of the drive, the corresponding item
is selected in the Capacity combo box.
Win95:
SHFD_CAPACITY_DEFAULT = 0 ' default drive capacity
SHFD_CAPACITY_360 = 3 ' 360KB, applies to 5.25" drives only
SHFD_CAPACITY_720 = 5 ' 720KB, applies to 3.5" drives only
WinNT(?)
...?
iFormatType
Value specifying the format operation, the corresponding option button is
selected in the Format type group box.
Win95
SHFD_FORMAT_QUICK = 0 ' quick format
SHFD_FORMAT_FULL = 1 ' full format
SHFD_FORMAT_SYSONLY = 2 ' copies system files only
WinNT
SHFD_FORMAT_FULL = 0 ' full format
SHFD_FORMAT_QUICK = 1 ' quick format
Return values
Win95
-3 failure, drive can't be formatted (either doesn't exist or contains files in use by Windows)
-2 operation cancelled
-1 operation attempted but completed unsuccessfully
6(?) operation completed successfully
WinNT
-1 dialog was shown
0 error, dialog not shown
SHFormatDrive también puede ser pasado a rundll32 y ejecutarse mediante el shell :
Dim l As Long
l = Shell("rundll32.exe shell32.dll,SHFormatDrive")
pero no parece que funcionen los parámetros.

