怎么样用vb代码写自动格式化硬盘的代码?
发布网友
发布时间:2024-10-15 00:56
我来回答
共1个回答
热心网友
时间:2024-10-15 18:09
在Drive的参数中 "A:" = 0,类推。
Private Const SHFMT_ID_DEFAULT = &HFFFF&
'Currently the only fmtID supported.
Private Declare Function SHFormatDrive Lib "shell32.dll" (ByVal hWnd As Long, ByVal
Drive As Long, fmtID As Long, Options As Long) As Long
Private Sub Command1_Click()
Dim lret As Long
lret = SHFormatDrive(Me.hWnd, 0, SHFMT_ID_DEFAULT, 0)
Select Case lret
Case -2
MsgBox "OK !"
Case -3
MsgBox "Cannot format a read only drive !"
End Select
End Sub