打开带外观的格式化对话框
#Include <WinAPIEx.au3>
_WinAPI_FormatDriveDlg ( $sDrive [, $iOption [, $hParent]] )
$sDrive | 要格式化的驱动器, 格式如D:, E:, 等. |
$iOption | [可选参数] 修改对话框中默认格式化选项. 此参数必须为 0 或下列值之一:. $SHFMT_OPT_FULL --- 选择"快速格式化"选项 $SHFMT_OPT_QUICKFORMAT $SHFMT_OPT_SYSONLY --- 选择"创建一个MS - DOS启动磁盘"选项,创建一个系统引导盘. |
$hParent | [可选参数] 对话框的父窗句柄. |
成功: | 返回 1. | |
失败: | 返回 0,设置@error: | |
@error: | ||
$SHFMT_ERROR --- 格式化错误 | ||
$SHFMT_CANCEL --- 格式化被取消 | ||
$SHFMT_NOFORMAT --- 驱动器不能被格式化 |
在MSDN中搜索
#Include <Array.au3>
#Include <ComboConstants.au3>
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $hForm, $Msg, $Drive, $Combo, $Button
$hForm = GUICreate('MyGUI', 200, 100)
$Drive = DriveGetDrive('ALL')
$Drive = StringUpper(_ArrayToString($Drive, '|', 1))
GUICtrlCreateLabel('Select drive:', 15, 29, 62, 14)
$Combo = GUICtrlCreateCombo('', 79, 25, 40, 21, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, $Drive, StringLeft($Drive, 2))
$Button = GUICtrlCreateButton('Format...', 65, 70, 70, 23)
GUISetState()
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case -3
ExitLoop
Case $Button
_WinAPI_FormatDriveDlg(GUICtrlRead($Combo), 0, $hForm)
EndSwitch
WEnd