progress bar while file move

hi every body

developing an application useing visuall basic 6 the programe is moving an audio file (.wav) from a workstation in my network to adirectory in the server
the problem is that when the user start moving the file by pressing move buttom the process take a long time and i need to inform him that the status of progress is 1% ....50% ect
i want to use the progress bar for doing so
thank in advance
Who is Participating?
In the example from the link I posted, change it to FO_MOVE and the source file will be deleted.

.wFunc = FO_COPY
.wFunc = FO_MOVE

how do you copy the file?
because in that code you have to update the progress bar
bahamoAuthor Commented:
yes not copying file but moveing file and my code is

FileCopy "c:\vbfiles\song1.wav", "c:\vbfiles\china\22.wav

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

bahamoAuthor Commented:
i did not make any progress bar for that yet my code is

 A = MoveFile(TARGET.Text, dest1.Text)
If A Then
MsgBox "File moved!"
MsgBox "Error. File not moved!"
End If

if you copy like that, it's not possible to have a progressbar....

you can however play an avi file of the filecopy,

find it in this path (default)
"c:\program files\microsoft visual studio\common\graphics\videos\file_copy.avi"

bahamoAuthor Commented:
so to be able to use aprogress bar how can i change my code to use the bar
bahamoAuthor Commented:
in fact i have idea that i want to translate into vb code :-
get the size of target wav file in byte  and while copying compare the target with destination wave file and keep on updateing the progress bar eatch time

you mean somthing like this:

'first add a timer, then use this code:

Option Explicit
Dim fSize As Long
Dim progress As Byte '(0 to 100)
Dim fName As String

Private Sub Form_Load()
   fName = "C:\enquete_tabel.doc"
   fSize = FileLen(fName)
   Timer1.Interval = 50
   Timer1.Enabled = True
   'copy file code here
End Sub

Private Sub Timer1_Timer()
   progress = FileLen(fName) / fSize * 100
End Sub
Copying via SHFileOperation() should show it's own progress notification:
bahamoAuthor Commented:
and please can you show me how to use SHFileOperation() for moving files inever use this function before
bahamoAuthor Commented:
o.k i will accept the answer from zzzzzooc  but before that i need to change the code in order to delete the wave file after copy to my dir becuase icant use it with move command
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.