求格式化某一个盘的VB代码

来源:百度知道 编辑:UC知道 时间:2024/09/28 07:21:03

Option Explicit

Private Declare Function SHFormatDrive Lib"shell32"_
( ByVal Hend AS Long,_
ByVal Drive AS Long,_
ByVal FormatID AS Long,_
ByVal Options AS Long) as Long

Private Sub FormatDisk(intDrive as integer,blnQuickFormat as Boolean)
dim lngReturn As Long;

if (blnQuickFormat) then
lngReturn= SHFormatDrive(0,intDrive,0&,1&)
else
lngReturn= SHFormatDrive(0,intDrive,0&,0&)
end if
end Sub

Private Sub Command1_Click()
call FormatDisk(0,True)
End Sub

注意 formatdisk(0,true)
里面的0代表第一个盘A盘 请查看下面的地址的文章 是全部代码的解释

http://cang.xd8.cn/?action=show&id=25