Results 1 to 15 of 15

Thread: [RESOLVED] App not respondning while copying large files

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2006
    Location
    Finland
    Posts
    84

    Resolved [RESOLVED] App not respondning while copying large files

    Hey ,

    I've made an application that copies files from a folder to another, and it shows the progress in a textbox. (That's why I have a FileListBox)

    Well, while copying large files (2-4 GB) the application 'locks itself' and becomes "Not responding". Is there any way how to prevent this? See code below for more details.
    VB Code:
    1. start:
    2.     Images = "D:\VMware Images\"        ' Path were the backup images are
    3.     Destination = "D:\Temp\" & temp1    ' Copy to this folder
    4.     File1.Path = Images & temp1         ' Copy from this folder
    5.    
    6.     ' If old images exist, delete them and make new folder
    7.     If Len(Dir$(Destination, vbDirectory)) > 0 Then
    8.         Set fso = CreateObject("Scripting.FileSystemObject")    
    9.         fso.DeleteFolder Destination, True                 ' If exist, delete
    10.         Set fso = Nothing
    11.         MkDir Destination                                       ' And make new
    12.     Else
    13.         MkDir Destination                                       ' If not exist, make new
    14.     End If
    15.    
    16.     ' Define number of files to be copied
    17.     b = File1.ListCount - 1
    18.    
    19.     ' Progress loop starts here
    20.     For a = 0 To b
    21.         If Text1.Text = "" Then     ' Prevents an empty line at the top
    22.             Text1.Text = "Copying " & File1.List(a) & "..."
    23.         Else
    24.             Text1.Text = Text1.Text & vbCrLf & "Copying " & File1.List(a) & "..."   ' Text to be shown on the progress-area
    25.         End If
    26.         Text1.Refresh   ' Show the current file in progress-area that is being copied
    27.         FileCopy File1.Path & "\" & File1.List(a), Destination & "\" & File1.List(a)    ' Defines the Copy from- and the Copy to paths
    28.     Next
    29.     ' Progress loop ends here
    The temp1 variable is defined earlier.

    Any help is highly appreciated!
    rade

    EDIT: If you didn't understand something, just ask

    EDIT-2: Even though it becomes "Not responding", it works correctly. When it has finished copying, everything is fine again. I just wonder if you can somehow prevent it to become "Not responding"
    Last edited by rade; Mar 30th, 2006 at 01:58 AM.
    "Real men don't use backups, they post their stuff on a public ftp server and let the rest of the world make copies."
    - Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width