# Function Reference

# _WinAPI_FormatDriveDlg

Opens the Shell's Format dialog

#include <WinAPIDlg.au3>
_WinAPI_FormatDriveDlg ( $sDrive [, $iOption = $SHFMT_OPT_FULL [, $hParent = 0]] )

## Parameters

$sDrive | The drive to format, in the format D:, E:, etc.
$iOption | [optional] This parameter must be 0 or one of the following values that alter the default format options in the dialog. $SHFMT_OPT_FULL (Default) $SHFMT_OPT_QUICKFORMAT $SHFMT_OPT_SYSONLY
$hParent | [optional] Handle of the parent window of the dialog.

## Return Value

Success: | The format ID of the last successful format. The LOWORD of this value can be passed on subsequent calls as the fmtID parameter to repeat the last format.
Failure: | 0 and sets the @error flag to one of the following constant. $SHFMT_ERROR $SHFMT_CANCEL $SHFMT_NOFORMAT

## Remarks

The format is controlled by the dialog interface.
That is, the user must click the OK button to actually begin the format—the format cannot be started programmatically.

## See Also

Search SHFormatDrive in MSDN Library.

## Example

    #include <Array.au3>
    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WinAPIDlg.au3>

    Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 200, 100)
    Local $vDrive = DriveGetDrive('ALL')
    $vDrive = StringUpper(_ArrayToString($vDrive, '|', 1))
    GUICtrlCreateLabel('Select drive:', 15, 29, 62, 14)
    Local $idCombo = GUICtrlCreateCombo('', 79, 25, 40, 21, $CBS_DROPDOWNLIST)
    GUICtrlSetData(-1, $vDrive, StringLeft($vDrive, 2))
    Local $idButton = GUICtrlCreateButton('Format...', 65, 70, 70, 23)
    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idButton
                _WinAPI_FormatDriveDlg(GUICtrlRead($idCombo), 0, $hForm)
        EndSwitch
    WEnd