|
-
Jul 8th, 2000, 09:32 PM
#1
Thread Starter
Fanatic Member
Ok i've been given several suggestions on how to go about doing this, the best one was to get the filelen and use it as the rate for the progress bar. But that has it's problems. What if the person is on a T1 and another person is on a 33.6. But the status bar will move the same for both. Is there a way to measure upload speeds? or at least know when an upload is done?
Plz help, Thank you,
D!m
-
Jul 8th, 2000, 09:41 PM
#2
You could just do:
Code:
For i = 0 to 100
Progressbar1.value = i
'your code
Next i
Or you could do:
Code:
Function timeout(interval)
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop
End Function
Progressbar1.Value = 5
timeout .1
Progressbar1.Value = 10
timeout .1
Progressbar1.Value = 10
timeout .1
Progressbar1.Value = 15
timeout .1
Progressbar1.Value = 20
timeout .1
Progressbar1.Value = 25
timeout .1
Progressbar1.Value = 30
timeout .1
.
.
.
.
.
Progressbar1.Value = 100
timeout .1
'you can do this as many times as you want and put your code in to.
Or:
Code:
Do: Doevents
Progressbar1.value = Progressbar1 + 2 'or how much you want to add by
'your code
Loop Until Progressbar1.value = 100
-
Jul 8th, 2000, 09:51 PM
#3
Thread Starter
Fanatic Member
I'm sorry but that code just didn't make alot of sense to me, can you plz explain it.
Just to make sure you understand what i want (basicly...an upload status bar)
Thanx,
D!m
-
Jul 8th, 2000, 10:06 PM
#4
I understand what you want to do.
Practice with the codes I gave you. Open a completely new form. Just place a Progressbar on the form. And put the complete codes, which I have commented.
Code:
For i = 0 to 100 'count to 100
Progressbar1.value = i 'make progressbar status count from 0 to 100
'your code
Next i 'loop it until you hit 100
Code:
Function timeout(interval)
'This code slows down the progress
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop
End Function
Progressbar1.Value = 0 'Progress bar status = 0
timeout .1 'timeout
Progressbar1.Value = 1 'Progress bar status = 1
timeout .1 'timeout
Progressbar1.Value = 2 'Progress bar status = 2
timeout .1 'timeout
Progressbar1.Value = 3 'Progress bar status = 3
timeout .1 'timeout
Progressbar1.Value = 4 'Progress bar status = 4
timeout .1 'timeout
Progressbar1.Value = 5 'Progress bar status = 5
timeout .1 'timeout
Progressbar1.Value = 10 'Progress bar status = 10
timeout .1 'etc.
Progressbar1.Value = 10 'etc.
timeout .1 'etc.
Progressbar1.Value = 15 'etc.
timeout .1
Progressbar1.Value = 20
timeout .1
Progressbar1.Value = 25
timeout .1
Progressbar1.Value = 30
timeout .1
.
.
.
.
.
Progressbar1.Value = 100
timeout .1
'you can do this as many times as you want and put your code in to.
Code:
Do: Doevents 'Start the Do code ;] DoEvents is to stop any freezing
Progressbar1.value = Progressbar1 + 2 'or how much you want to add by 'count by 2s
'your code
Loop Until Progressbar1.value = 100 'loop by 2s until progressbar equals 100
It shouldn't be so hard. Just copy the code in the form and it should all work, as long as you have a progressbar on the form .
-
Jul 8th, 2000, 10:16 PM
#5
Thread Starter
Fanatic Member
But see if i have my code in between the bar code, then i keep on reconnecting to the ftp as the file is being uploaded. B/c i have one button that connects/uploads/activate bar
-
Jul 8th, 2000, 10:21 PM
#6
Thread Starter
Fanatic Member
lol and it also uploads the files over and over and over. =)
-
Jul 8th, 2000, 10:39 PM
#7
Yeah, I realized that .
So than just use the
Progressbar1.Value = 5
timeout .1
Progressbar1.Value = 10
timeout .1
Progressbar1.Value = 15
code.
Or if you can wait an hour or probably less than that ;]...than I can come up with something else.
It'll be like that Filelen one, but a little different.
....[works on it]....
-
Jul 8th, 2000, 11:02 PM
#8
Thread Starter
Fanatic Member
Matthew,
you have been a GREAT help, but i figured out how to do it. I can put a label and keep on chenging it's caption as the events occur. =). Or even put a status bar at the end of the code and that will also show the user that the upload finished. Thank you for your help.
If you are willing, i would like to ask you another question. I'm opening a browser with a url that is specified by a string, so i have...
<code>
Shell (url)
</code>
but the problem is, i don't want the user to see the browser windowm open.
I also tried using the "MyIE" way by opening an IE window. But that will cause problems if the user has netscape.
Do you know how i can open the url behind the users back.
Thank you,
D!m
-
Jul 8th, 2000, 11:03 PM
#9
Ok, I think this might work:
Code:
b = FileLen("C:\Command.com") / 8000
If b = 0 Then b = 1
b2 = 100 / b
b3 = b2
'lil code here
If b3 < 100 Then
ProgressBar1.Value = b3
timeout 0.0000001
End If
b3 = b3 + b2
'the rest of the code here
ProgressBar1.Value = b3
timeout 0.0000001
ProgressBar1.Value = 100
-
Jul 8th, 2000, 11:09 PM
#10
Member
Better Matthew
That looks better and shorter to me.
I hope my comments aren't offensive.
I think you are brilliant, even at 15 1/2.
-
Jul 8th, 2000, 11:11 PM
#11
Code:
vbHide 0 Window is hidden and focus is passed to the hidden window.
Example:
Address$ = "http://www.site.com"
Shell("Start.exe " & Address$, vbHide)
Code:
Public Const SW_SHOWNORMAL = 1
Public Const SW_ShowMinimized = 2
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_Hide = 0
Public Const SW_MAX = 10
Public Const SW_MAXIMIZE = 3
Public Const SW_MINIMIZE = 6
Public Const SW_NORMAL = 1
Open Default Browser
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
a = ShellExecute(Me.hwnd, vbNullString, "http://www.site.com", vbNullString, "c:\", SW_Hide)
Hehe..I'm gonna be 16 soon in about 4 months ;].
[Edited by Matthew Gates on 07-09-2000 at 12:13 AM]
-
Jul 8th, 2000, 11:19 PM
#12
Thread Starter
Fanatic Member
Thanx alot, that will help me alot.
You've been a great help, and now i know who to go to if i need more help.
Thanx,
D!m
-
Jul 9th, 2000, 12:39 PM
#13
Originally posted by Dim
Matthew,
you have been a GREAT help, but i figured out how to do it. I can put a label and keep on chenging it's caption as the events occur. =). Or even put a status bar at the end of the code and that will also show the user that the upload finished.
That is quite what this code does:
Code:
Progressbar1.Value = 5
timeout .1
'do a little
Progressbar1.Value = 10
timeout .1
'do a lil more
Progressbar1.Value = 15
timeout .1
'some more?
Progressbar1.Value = 20
timeout .1
'getting lazy?
-
Jul 9th, 2000, 05:50 PM
#14
Thread Starter
Fanatic Member
Yup,
With that out of the way, i'm finaly finished my project and want to thank all that helped. Esp..Matthew and Maayan.
Now i'll try to return the favot by helping as many ppl as possible on vbhelp.com and here.
Laterz,
D!m
-
Jul 9th, 2000, 06:47 PM
#15
Can I take a look at the program?
Email it to me at [email protected] if you want.
Thank you.
-
Jul 9th, 2000, 07:20 PM
#16
Thread Starter
Fanatic Member
Umm...i'm not sure if i can release it yet. It *should* be available on calgarymbe.com fairy soon.
It just basicly connects to a private ftp, sends user info to the administration by a url which is formed by combining several variables collected by the gui and allows the user to upload files to the ftp. I dun think it would be much use to you =).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|