VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Fixes to Dual Directories. Sorry folks, you need the msvbvm60.dll inside the system folder to run o

by James McCord (2 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 6th September 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Fixes to Dual Directories. Sorry folks, you need the msvbvm60.dll inside the system folder to run on Win98. Also there is a modification to

API Declarations


'Update the two sub routines:
Global Copy_Path as String

Rate Fixes to Dual Directories. Sorry folks, you need the msvbvm60.dll inside the system folder to run o



Private Sub CopyFiles()
List1.Clear
sFile = True
Dim Files() As String
   Dim Path As String
   Dim i As Long, n As Long
   
   If Form1.ActiveControl = File1 Then
   Path = Dir1.Path
   Copy_Path = Dir1.Path
   If Right(Path, 1) <> "\" Then
      Path = Path & "\"
   End If
   
   ' Build array of files.
   With File1
      For i = 0 To .ListCount - 1
         If .Selected(i) Then
            ReDim Preserve Files(0 To n) As String
            Files(n) = Path & .List(i)
            List1.AddItem Files(n)
            n = n + 1
         End If
      Next i
   End With
   
   Else
   If Form1.ActiveControl = File2 Then
   Path = Dir2.Path
   Copy_Path = Dir2.Path
   If Right(Path, 1) <> "\" Then
      Path = Path & "\"
   End If
   
   ' Build array of files.
   With File2
      For i = 0 To .ListCount - 1
         If .Selected(i) Then
            ReDim Preserve Files(0 To n) As String
            Files(n) = Path & .List(i)
            List1.AddItem Files(n)
            n = n + 1
         End If
      Next i
   End With
   
End If
End If


End Sub
'---------------------------------------------
Private Sub pasteFile()
Form1.MousePointer = vbHourglass
 Dim result As Long
 Dim fileop As SHFILEOPSTRUCT
 Dim intLoop As Integer
 Dim sItem As String
 Dim sFlag As Long
 
 If sCopy = True Then
   If folderDestination = Copy_Path Then
   sFlag = FOF_FILESONLY + FOF_RENAMEONCOLLISION
   Else
   sFlag = FOF_FILESONLY
   End If
   
    For intLoop = 0 To List1.ListCount - 1
    sItem = sItem & List1.List(intLoop) & vbNullChar
     Next intLoop
         With fileop
            .hwnd = Me.hwnd
            .wFunc = FO_COPY
            .pFrom = sItem & vbNullChar & vbNullChar
            .pTo = folderDestination & vbNullChar & vbNullChar
            .fFlags = sFlag
         End With

         result = SHFileOperation(fileop)

         If result <> 0 Then        'Operation failed
            MsgBox result, , "Copy Operation Failed"
         Else
            If fileop.fAnyOperationsAborted <> 0 Then
               MsgBox fileop.fAnyOperationsAborted, , "Operation Aborted"
            End If
         End If
         File1.Refresh
         File2.Refresh
         'List1.Clear
         Undo.Caption = "&Undo Copy"
         Form1.MousePointer = vbDefault
End If

If sCut = True Then
For intLoop = 0 To List1.ListCount - 1
    sItem = sItem & List1.List(intLoop) & vbNullChar
    Next intLoop
         With fileop
            .hwnd = Me.hwnd
            .wFunc = FO_MOVE
            .pFrom = sItem & vbNullChar & vbNullChar
            .pTo = folderDestination & vbNullChar & vbNullChar
           ' .fFlags = FOF_MULTIPLEFILES
         End With

         result = SHFileOperation(fileop)

         If result <> 0 Then        'Operation failed
            MsgBox result, , "Move Operation Failed"
         Else
            If fileop.fAnyOperationsAborted <> 0 Then
               MsgBox fileop.fAnyOperationsAborted, , "Operation Aborted"
            End If
         End If
         File1.Refresh
         File2.Refresh
         'List1.Clear
         Form1.MousePointer = vbDefault
         Undo.Caption = "&Undo Cut"
End If
 
End Sub



Download this snippet    Add to My Saved Code

Fixes to Dual Directories. Sorry folks, you need the msvbvm60.dll inside the system folder to run o Comments

No comments have been posted about Fixes to Dual Directories. Sorry folks, you need the msvbvm60.dll inside the system folder to run o. Why not be the first to post a comment about Fixes to Dual Directories. Sorry folks, you need the msvbvm60.dll inside the system folder to run o.

Post your comment

Subject:
Message:
0/1000 characters