I would like to make progress bar.. How I can show the prograss bar with the time taken to open my application. How I can start on this?
Printable View
I would like to make progress bar.. How I can show the prograss bar with the time taken to open my application. How I can start on this?
Hmm I think you will find this pretty difficult. You need to use the GetTickCount API, but if you increase the progress bar by so much each time, it will appear to be stuck at the same percentage.
Hmm.. can we use the timer on the computer to process the application and show us the progress bar with time it take to start the application. It depend on the computer processor
Check link below...GetTickCount
How are you opening your application? Do you mean to show a progress bar while your program loads stuff when it starts?
Can you post some of the code you have to "load" your program? I personally wouldn't use a timer or GetTickCount but put the progressbar code in the procedures that load stuff before your program starts.
i will also ask the same question as DigiRev ask you...
post up quickly so i can post the code sample you wnt
Or, you need a false Progress bar to display?
For things like this, this is what I've always done.Quote:
Originally Posted by r_amin
Sometimes it is just hard, or even impossible, to programmatically get an accurate count, so you guesstimate.
Re_Time is just a subroutine which... well, here:Code:ProgressBlit = (100 / HowManyCyclesWeAreDoing) 'do this before the loop
i = 0
Do
DoEvents
i = i + 1 'i is the loop-counter, we're checking the timer once every 10 loops. (1 loop in mine was too short to measure)
'stuff
'more stuff
'still more stuff
If (i Mod 10) = 0 Then
If i > 0 Then Interval = ((Interval * 49) + ((Timer - lTime) / 10)) / 50
'Interval is an approximation of how long 1 loop is taking; weighted to favor what was rather than what is.
If i > 0 Then Int_Mod = Int(Interval * (T_Int - i))
ReTime (Int_Mod)
lTime = Timer
End If
ProgressBar.Value = ProgressBar.Value + ProgressBlit
Loop Until i = 3000000 'or whatever
Code:Private Sub ReTime(Int_Mod As Long)
LblTimer.Caption = LblTimer.Caption + " " + Str(Int_Mod) & "seconds remaining"
LblTimer.Refresh
End Sub
I no idea how to start.I don't know how to start so I would like to see the sample so that I got and idea.Quote:
Originally Posted by jin29_neci
I just use the mouse down click on application exe manually like your done to open the word program :D . I would like to do like this While waiting the program is opened, I would like to show the prograss bar to let me know that the program I try to open is still in process.
Progress bars are incremented during loops.
Are you doing any looping when your application starts?
How I can use your code?Quote:
Originally Posted by Senacharim
Quote:
Originally Posted by matrik02
Above is the important part, if all you want is a progress bar.Code:ProgressBlit = (100 / HowManyCyclesWeAreDoing)
'the progressblit sets the increment, or how far the progress bar moves for_
each cycle.
i = 0
' i is the counter, for how many loops for progressed.
'alternately, one could use a For i = 1 to x : Next i to do the same.
Do
i = i + 1
ProgressBar.Value = ProgressBar.Value + ProgressBlit
Loop Until i = 300 'or whatever
You'll need to add a progress bar object to your form as well.
Please notice the loop that I have previously indicated needs to be present in order to effectively use the progress bar.
here this is a light sample so u wont get confusedQuote:
Originally Posted by matrik02
Code:'the time interval is 100
'the pb.value is the progress bar value
Private Sub Timer1_Timer()
pb.Value = pb.Value + 1
If (pb.Value = 2) Then
lblWait.Caption = "Please Wait"
ElseIf (pb.Value = 4) Then
lblWait.Caption = ""
ElseIf (pb.Value = 8) Then
lblWait.Caption = "Please Wait"
ElseIf (pb.Value = 12) Then
lblWait.Caption = ""
ElseIf (pb.Value = 16) Then
lblWait.Caption = "Please Wait"
ElseIf (pb.Value = 20) Then
lblWait.Caption = ""
ElseIf (pb.Value = 24) Then
lblWait.Caption = "Please Wait"
ElseIf (pb.Value = 28) Then
lblWait.Caption = ""
ElseIf (pb.Value = 32) Then
lblWait.Caption = "Connecting"
ElseIf (pb.Value = 36) Then
lblWait.Caption = ""
ElseIf (pb.Value = 40) Then
lblWait.Caption = "Connecting"
ElseIf (pb.Value = 44) Then
lblWait.Caption = ""
ElseIf (pb.Value = 48) Then
lblWait.Caption = "Connected"
End If
If pb.Value = 50 Then
Unload Me
frmLogin.Show
End If
End Sub
i hope this might help and wont get u confused