首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

vb6程序发布成EXE后在其他机器上运行报RUN-TIME ERROR 70,该怎么处理

2012-01-11 
vb6程序发布成EXE后在其他机器上运行报RUN-TIME ERROR 70本机运行正常, 发布成EXE后,在其他机器运行后,扫

vb6程序发布成EXE后在其他机器上运行报RUN-TIME ERROR 70
本机运行正常, 发布成EXE后,在其他机器运行后,扫描可以运行扫描过程中点停止后出现 70错误 程序如下:

VB code
 
Option Explicit
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
  Dim fso
  Dim fn    As String
  Dim SFlag    As Boolean
   
Private Sub Form_Initialize()

Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
End Sub
  Private Sub Command1_Click()
 
  Dim fd    As String
  Dim DrvNum As Single
  Dim drvName As String
  Dim DrvType As Integer
  Dim i As Integer
  Set fso = CreateObject("Scripting.FileSystemObject")
  List1.Clear
  SFlag = True
  Command1.Enabled = False
  Command2.Enabled = True

 
  Drive1.Visible = False
  DrvNum = Asc("a") - 1
  For i = 0 To Drive1.ListCount
        DrvNum = DrvNum + 1
        drvName = Chr(DrvNum) & ":\"
        DrvType = GetDriveType(drvName) '判断驱动器类型
      If GetDriveType(drvName) = 3 Then '硬盘
        fd = drvName
        Call getFilenm(fd)
        End If
  Next
  Command3.Enabled = True
  End Sub
   
  Function getFilenm(fdnm As String)
  Dim obFd, fl, sfd
  DoEvents
  Me.Label1.Caption = fdnm
  Set obFd = fso.GetFolder(fdnm)
      For Each fl In obFd.Files
      DoEvents
       
      '    是否停止
      If SFlag = False Then
            Exit Function
      End If
            If fl.Name = "dafsd.txt" Then
              List1.AddItem fdnm & "\" & fl.Name
             
            End If
      Next
       
           
  If obFd.SubFolders.Count > 0 Then
      For Each sfd In obFd.SubFolders
          Call getFilenm(sfd.Path)
      Next
  End If
  End Function
   
  Private Sub Command2_Click()
 
  SFlag = False
  Command1.Enabled = True
  Command2.Enabled = False
  Command3.Enabled = True

  End Sub

  Private Sub Command3_Click()
  Command3.Enabled = False
  Dim tim  As String
  Dim i    As Integer
  For i = 0 To List1.ListCount - 1
  Kill List1.List(i)
  tim = "(" & Now() & ")"
  Call WritePrivateProfileString("Information", "File", List1.List(i) & tim, "c:\windows\Infor.ini")
  Next
  If List1.ListCount > 0 Then
    List1.Clear
    MsgBox "成功删除"
  Else
    MsgBox "没有找到,不需要清除"


  End If
 
 
 
Command2.Enabled = True

  End Sub




[解决办法]
Error(70) Permission denied
可能当前用户没有某些目录的访问权。
[解决办法]
VB code
'理论上是这个过程出错。  Private Sub Command3_Click()  Command3.Enabled = False    On Error GoTo ErrorHandle:           '添加错误处理    Dim tim   As String  Dim i     As Integer  For i = 0 To List1.ListCount - 1  Kill List1.List(i)                         '错误很可能发生在这一句,遇到无法删除的文件   tim = "(" & Now() & ")"   Call WritePrivateProfileString("Information", "File", List1.List(i) & tim, "c:\windows\Infor.ini")  Next  If List1.ListCount > 0 Then    List1.Clear    MsgBox "成功删除"  Else    MsgBox "没有找到,不需要清除"  End If  Exit SubErrorHandle:   MsgBox Err.DescriptionEnd Sub
[解决办法]
70 拒绝的权限
检查一下你访问资源的权限
[解决办法]
这属于不可浏览的“目录”,跳过它。

热点排行