FileCopy "c:\aaa.mdb", "\\pc98\data\aaa.mdb"

解决方案 »

  1.   

    dir(目录名)如返回为空串则为不存在。
      

  2.   

    http://www.csdn.net/expert/topic/575/575860.xml?temp=.5091974
      

  3.   

    http://www.csdn.net/expert/topic/575/575860.xml?temp=.5091974
      

  4.   

    不知道除了filecopy,还有没有别的方法,最好能有进度的显示,不知道有没有高手有这方面的经验
      

  5.   

    if is readonly share how to do?
      

  6.   

    除了filecopy,还可用SHFileOperation,有进度的显示Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
    Private 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
     Const FO_COPY = &H2
     Const FOF_SIMPLEPROGRESS = &H100
    Private Sub Command1_Click()
        Dim fileOp As SHFILEOPSTRUCT
        Dim rtn As Long
        With fileOp
        
        .hwnd = Me.hwnd
        .wFunc = FO_COPY
        .pFrom = "d:\backup\*.*"
        .pTo = "e:\"
        .fFlags = FOF_SIMPLEPROGRESS
        End With
        rtn = SHFileOperation(fileOp)
        
    End Sub
      

  7.   

    偶的最后一问,如果共享目录设置了密码的话(win98),如何才可以访问并复制文件呢?
      

  8.   

    用WNetAddConnection 联接
    代码如下:
    Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
    Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
    Private 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
     Const FO_COPY = &H2
     Const FOF_SIMPLEPROGRESS = &H100
    Private Sub Command1_Click()
        Dim fileOp As SHFILEOPSTRUCT
        Dim rtn As Long
        rtn = WNetAddConnection("\\mit002\temp", "111", "")  '111为password
        With fileOp
        .hwnd = Me.hwnd
        .wFunc = FO_COPY
        .pFrom = "c:\a.txt"
        .pTo = "\\mit002\temp"
        .fFlags = FOF_SIMPLEPROGRESS
        End With
        rtn = SHFileOperation(fileOp)
        
    End Sub