首页 | 社区 | 博客 | 招聘 | 文章 | 新闻 | 下载 | 读书 | 代码
亲,您未登录哦! 登录 | 注册

格式化磁盘演示

打印文章

分享到:
Private Declare Function GetSystemDirectory Lib "kernel32" Alias _
"GetSystemDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation _
As String, ByVal lpFile As String, ByVal lpParameters _
As String, ByVal lpDirectory As String, ByVal nShowCmd _
As Long) As Long

Const SW_SHOW = 5

Private Sub Command1_Click()
Dim sFor As String
Dim sTemp As String

sFor = String(260, " ")
GetWindowsDirectory sFor, 260
sTemp = Left$(sFor, InStr(sFor, Chr(0)) - 1) + "\rundll32.exe" _
+ Chr(0)
ShellExecute Me.hwnd, vbNullString, sTemp, _
"Shell32.dll,SHFormatDrive" + Chr(0), "c:\" + Chr(0), _
SW_SHOW
End Sub

本栏文章均来自于互联网,版权归原作者和各发布网站所有,本站收集这些文章仅供学习参考之用。任何人都不能将这些文章用于商业或者其他目的。( Pfan.cn )

编程爱好者论坛

本栏最新文章