如何用VB 检测软盘错误?像 写保护,盘没插入,盘满等错误?在线等,急!!! 我试了检测 Err.number ,可是,不论是没有插入软盘,还是软盘写保护,以及目录不是软盘时如:dd:\a.txt 等错误路径时,错误号都是 52,真是怪了,请问各位大虾,有什么办法没有?在线等,急啊!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我记得用 filesystemobject 可以实现。 谢谢大家!to:Leemaasn(小马仙哥) 可否告诉我具体怎么用? 检测 Err.number 前,先对错误陷井初始化on error goto 0'错误陷井初始化on error resume next'程序,读入文件if err.number=52 or err.number=68 thenend ifon error goto 0'错误陷井初始化 相当于把err.number清为0。如ON ERROR RESUME RESET后跟ON ERROR GOTO 0则原有ON ERROR RESUME RESET不再起作用。On Error GoTo 0 禁止当前过程中任何已启动的错误处理程序。 我现在没办法给你ref code,你自己上网搜索一下file system object的方法看看吧。 Function FileErrors ()As Integer Dim intMsgType As Integer, strMsg As String Dim intResponse As Integer '返回值 含义 ' 0 继续 ' 1 继续下一个 ' 2 不可恢复的错误 ' 3 无法辨认的错误 intMsgType = vbExclamation Select Case Err.Number Case MnErrDeviceUnavailable '错误 68。 strMsg = "That device appears unavailable." intMsgType = vbExclamation + 4 Case MnErrDiskNotReady ' 错误 71。 strMsg = "Insert a disk in the drive " strMsg = strMsg & "and close the door." intMsgType = vbExclamation + 4 Case MnErrDeviceIO ' 错误 57。 strMsg = "Internal disk error." intMsgType = vbExclamation + 4 Case MnErrDiskFull '错误 61。 strMsg = "Disk is full. Continue?" intMsgType = vbExclamation + 3 '错误 64 和 52。 Case ErrBadFileName, ErrBadFileNameOrNumber strMsg = "That filename is illegal." intMsgType = vbExclamation + 4 Case ErrPathDoesNotExi ' 错误 76。 strMsg = "That path doesn't exist." intMsgType = vbExclamation + 4 Case ErrBadFileMode ' 错误 54。 strMsg = "Can't open your file for that " strMsg = strMsg & "type of access." intMsgType = vbExclamation + 4 Case ErrFileAlreadyOpen ' 错误 55。 strMsg = "This file is already open." intMsgType = vbExclamation + 4 Case ErrInputPastEndOfFile ' 错误 62。 strMsg = "This file has a nonstandard " strMsg = strMsg & "end-of-file er, " strMsg = strMsg & "or an attempt was made ” strMsg = strMsg & “to read beyond " strMsg = strMsg & "the end-of-file er." intMsgType = vbExclamation + 4 Case Else FileErrors = 3 Exit Function End Select intResponse = MsgBox (strMsg, intMsgType, _ "Disk Error") Select Case intRresponse Case 1, 4 ' “确定”、“重试”按钮。 FileErrors = 0 Case 5 ' “忽略”按钮。 FileErrors = 1 Case 2, 3 ' “取消”、“结束”按钮。 FileErrors = 2 Case Else FileErrors = 3 End SelectEnd Function该过程处理公共文件和磁盘相关错误。如果错误与磁盘输入/输出无关,则返回数值 3。 BIOS调用可以的!但是VB好像不好实现! 哎?怪了,今天下午给分了,szyhy810518(!?!) :40分,Leemaasn(小马仙哥) 35分, yimain(残雪) 10分,其他的各分了5分,怎么大家的得分还是0啊?当时给完分,系统有一个对话框,我没看就点了确定,是不是这个的事?现在想重新给分,可是,不行了,只能删除帖子,怎么回事?再次谢谢大家的帮助!!!谁能告诉我分怎么给? vb 操作 oracle中的CLOB字段。。。 txtbox判断的问题 怎样打开CHM文件 vb,sql语言又一个狂菜的问题? 如何限制msgbox的位置? vb 小问题 vb的实时错误'28' 堆栈空间溢出 关于SQL 语句中的like问题?(谁能帮我完全解决此问题,愿以285分作谢!) 请问,在dataReport中的RptTextBox的数据可以在程序运行中动态绑定吗?如果可以要怎么做? 急,关于WINSOCK的问题 报表显示时设置纸张大小问题(A3类型的纸) QQ怎样自已加自已啊?
to:Leemaasn(小马仙哥) 可否告诉我具体怎么用?
on error goto 0'错误陷井初始化
on error resume next
'程序,读入文件
if err.number=52 or err.number=68 thenend ifon error goto 0'错误陷井初始化
你自己上网搜索一下file system object的方法看看吧。
Dim intMsgType As Integer, strMsg As String
Dim intResponse As Integer
'返回值 含义
' 0 继续
' 1 继续下一个
' 2 不可恢复的错误
' 3 无法辨认的错误
intMsgType = vbExclamation
Select Case Err.Number
Case MnErrDeviceUnavailable '错误 68。
strMsg = "That device appears unavailable."
intMsgType = vbExclamation + 4
Case MnErrDiskNotReady ' 错误 71。
strMsg = "Insert a disk in the drive "
strMsg = strMsg & "and close the door."
intMsgType = vbExclamation + 4
Case MnErrDeviceIO ' 错误 57。
strMsg = "Internal disk error."
intMsgType = vbExclamation + 4
Case MnErrDiskFull '错误 61。
strMsg = "Disk is full. Continue?"
intMsgType = vbExclamation + 3
'错误 64 和 52。
Case ErrBadFileName, ErrBadFileNameOrNumber
strMsg = "That filename is illegal."
intMsgType = vbExclamation + 4
Case ErrPathDoesNotExi ' 错误 76。
strMsg = "That path doesn't exist."
intMsgType = vbExclamation + 4
Case ErrBadFileMode ' 错误 54。
strMsg = "Can't open your file for that "
strMsg = strMsg & "type of access."
intMsgType = vbExclamation + 4
Case ErrFileAlreadyOpen ' 错误 55。
strMsg = "This file is already open."
intMsgType = vbExclamation + 4
Case ErrInputPastEndOfFile ' 错误 62。
strMsg = "This file has a nonstandard "
strMsg = strMsg & "end-of-file er, "
strMsg = strMsg & "or an attempt was made ”
strMsg = strMsg & “to read beyond "
strMsg = strMsg & "the end-of-file er."
intMsgType = vbExclamation + 4
Case Else
FileErrors = 3
Exit Function
End Select
intResponse = MsgBox (strMsg, intMsgType, _
"Disk Error")
Select Case intRresponse
Case 1, 4 ' “确定”、“重试”按钮。
FileErrors = 0
Case 5 ' “忽略”按钮。
FileErrors = 1
Case 2, 3 ' “取消”、“结束”按钮。
FileErrors = 2
Case Else
FileErrors = 3
End Select
End Function该过程处理公共文件和磁盘相关错误。如果错误与磁盘输入/输出无关,则返回数值 3。
但是VB好像不好实现!
yimain(残雪) 10分,其他的各分了5分,怎么大家的得分还是0啊?
当时给完分,系统有一个对话框,我没看就点了确定,是不是这个的事?现在想重新给分,可是,不行了,只能删除帖子,怎么回事?
再次谢谢大家的帮助!!!谁能告诉我分怎么给?