|
-
May 11th, 2008, 08:40 AM
#1
Thread Starter
Frenzied Member
Progress bar and timer
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?
-
May 11th, 2008, 09:46 AM
#2
Re: Progress bar and timer
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.
If a post has been helpful please rate it. 
If your question has been answered, pull down the tread tools and mark it as resolved.
-
May 11th, 2008, 10:03 AM
#3
Thread Starter
Frenzied Member
Re: Progress bar and timer
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
-
May 11th, 2008, 01:39 PM
#4
Fanatic Member
Re: Progress bar and timer
Check link below...GetTickCount
Alpha Micro: Alpha Basic, AS400 V5r2, EDI (Trusted Link/ Inovis.com),Access AS/400 via VB6, Qbasic for data conversions. A mix of Hardware too. ASCII Table , New Number to Words/66 digits , AS/400(v5r2) VB6 Viewer/Ask for code(ODBC) ^ What Is Transferring? , Check your Ports #Perfect Passwords , *Slide Bar Example , Logoff, Restart, Shut-Down PC *Keep Form On Top , Opaque Form ^ Create Objects at Run Time @ Check Key Caps Locks # GetTickCount(System Up Time) * Convert text to Excel & Collected Icons + Resize: Form/Text box ^ PC GateWay via Shell $ Drag & Drop Game ! PopUpMenu *Print File/no Open# Timer on Mult Forms ~ Splash & Mult Forms & Lots of Comments + Random/Timer/Guess * Dec >Hex >Oct >Bin % Get MAC (NIC) < saving to Registry > Wookiee Cookies \ BackUpDisk / World Conection SpeedTest $ Glossary Commonly Used Terms # phonetic list @ Detailed Computer Scan
When posting Code, Use tags.. [CODE] *Your Code* [/CODE]
-
May 11th, 2008, 03:54 PM
#5
Re: Progress bar and timer
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.
-
May 11th, 2008, 11:47 PM
#6
Junior Member
Re: Progress bar and timer
i will also ask the same question as DigiRev ask you...
post up quickly so i can post the code sample you wnt
-
May 12th, 2008, 02:03 AM
#7
Addicted Member
Re: Progress bar and timer
Or, you need a false Progress bar to display?
-
May 12th, 2008, 09:33 AM
#8
Re: Progress bar and timer
 Originally Posted by r_amin
Or, you need a false Progress bar to display?
For things like this, this is what I've always done.
Sometimes it is just hard, or even impossible, to programmatically get an accurate count, so you guesstimate.
-
May 12th, 2008, 09:48 AM
#9
Member
Re: Progress bar and timer
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
Re_Time is just a subroutine which... well, here:
Code:
Private Sub ReTime(Int_Mod As Long)
LblTimer.Caption = LblTimer.Caption + " " + Str(Int_Mod) & "seconds remaining"
LblTimer.Refresh
End Sub
_____________________________
. Error Code 34: There is no error .
-
May 12th, 2008, 09:53 AM
#10
Thread Starter
Frenzied Member
Re: Progress bar and timer
 Originally Posted by jin29_neci
i will also ask the same question as DigiRev ask you...
post up quickly so i can post the code sample you wnt
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.
I just use the mouse down click on application exe manually like your done to open the word program . 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.
-
May 12th, 2008, 11:40 AM
#11
Re: Progress bar and timer
Progress bars are incremented during loops.
Are you doing any looping when your application starts?
-
May 12th, 2008, 12:48 PM
#12
Thread Starter
Frenzied Member
Re: Progress bar and timer
 Originally Posted by Senacharim
Code:
ProgressBlit = (100 /
How I can use your code?
-
May 12th, 2008, 12:53 PM
#13
Member
Re: Progress bar and timer
 Originally Posted by matrik02
How I can use your code?
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
Above is the important part, if all you want is a progress bar.
You'll need to add a progress bar object to your form as well.
Last edited by Senacharim; May 12th, 2008 at 01:34 PM.
_____________________________
. Error Code 34: There is no error .
-
May 12th, 2008, 01:09 PM
#14
Re: Progress bar and timer
Please notice the loop that I have previously indicated needs to be present in order to effectively use the progress bar.
-
May 12th, 2008, 03:26 PM
#15
Junior Member
Re: Progress bar and timer
 Originally Posted by matrik02
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.
I just use the mouse down click on application exe manually like your done to open the word program  . 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.
here this is a light sample so u wont get confused
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
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
|