在线等--VB调用API删除多个文件(其中有子目录和文件)以及格式化一个指定硬盘

lzj34 2003-10-13 10:00:04
在线等--VB调用API删除多个文件(其中有子目录和文件)以及格式化一个指定硬盘(逻辑盘)
...全文
46 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzj34 2003-10-14
  • 打赏
  • 举报
回复
谢谢各位了
射天狼 2003-10-13
  • 打赏
  • 举报
回复
同意楼上!!
TechnoFantasy 2003-10-13
  • 打赏
  • 举报
回复
删除文件和目录可以用API函数SHFileOperation
online 2003-10-13
  • 打赏
  • 举报
回复
Public Declare Function SHFileOperation Lib "shell32.dll" Alias " SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long

Public Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Long
hNameMappings As Long
lpszProgressTitle As String ' only used if FOF_SIMPLEPROGRESS
End Type

dim filleoperation as shfileopstruct
dim lreturn as long
dim stemp as string
stemp="c:\temp.txt"
with fileoperation
.wfunc=FD_DELETE
.pfrom=stemp
.fflags=FOF_ALLOWUNDO
end with
lreturn=shfileoperation(fileoperation)
online 2003-10-13
  • 打赏
  • 举报
回复
private declare function shformatdrive lib "shell32.dll"(byval hwnd as long,byval drive as long,fmtid as long,options as long) as long
private const shfmt_id_default=&hffff&

dim lret as long
lret=shformatdrive(me.hwnd,0,shfmt_id_default,0)
select case lret
case -2
msgbox "ok"
case
msgbox "cannot format a read only drive"
end select
end sub
请慎重使用
lzj34 2003-10-13
  • 打赏
  • 举报
回复
因为本人很菜所以还请各位请明白一点

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧