Solved

progress bar while file move

Posted on 2006-06-28
11
2,081 Views
Last Modified: 2013-12-25
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
0
Comment
Question by:bahamo
  • 6
  • 3
  • 2
11 Comments
 
LVL 13

Expert Comment

by:Mark_FreeSoftware
ID: 17000192

how do you copy the file?
because in that code you have to update the progress bar
0
 

Author Comment

by:bahamo
ID: 17001937
yes not copying file but moveing file and my code is

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

0
 

Author Comment

by:bahamo
ID: 17001997
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!"
Else
MsgBox "Error. File not moved!"
End If
0
 
LVL 13

Expert Comment

by:Mark_FreeSoftware
ID: 17002325

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"

0
 

Author Comment

by:bahamo
ID: 17002862
so to be able to use aprogress bar how can i change my code to use the bar
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:bahamo
ID: 17003083
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
0
 
LVL 13

Expert Comment

by:Mark_FreeSoftware
ID: 17003292

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
0
 
LVL 17

Expert Comment

by:zzzzzooc
ID: 17007408
Copying via SHFileOperation() should show it's own progress notification:
http://www.experts-exchange.com/Q_21429742.html
0
 

Author Comment

by:bahamo
ID: 17007612
and please can you show me how to use SHFileOperation() for moving files inever use this function before
0
 

Author Comment

by:bahamo
ID: 17022722
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
0
 
LVL 17

Accepted Solution

by:
zzzzzooc earned 250 total points
ID: 17025302
In the example from the link I posted, change it to FO_MOVE and the source file will be deleted.

Change:
.wFunc = FO_COPY
to...
.wFunc = FO_MOVE
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now