Countdown timer in VB6
|
Original Message
|
Name: Richard_Sheath
Date: February 8, 2006 at 17:48:07 Pacific
Subject: Countdown timer in VB6OS: XP SP2CPU/Ram: P4 3ghz 1024mb |
Comment: I wish to have a 5 minute countdown on a form in VB6 that can be overidden by a button click that then shells out to a windows installer. If the end user does not click the button then the Windows installer happens anyway. Anyone help? I've done the Windows installer shelling out ok, just need help withthe timer
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: StuartS
Date: February 9, 2006 at 02:32:01 Pacific
Subject: Countdown timer in VB6 |
Reply: (edit)Set you time to count for 6000. That will give a one minute delay. Create a public variable and initiate it to five. When the time is activated after each minute, decrease the public variable. When it reaches zero, you have your five minute delay and you can act appropriately. To override the timer just disable the timer in the button click event. Stuart
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: jhunt303
Date: February 22, 2006 at 09:10:54 Pacific
Subject: Countdown timer in VB6 |
Reply: (edit)Dimension a Date Stamp to a variable then add 5 minutes to it, just run a timer to check the value and when it matches, hey presto
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: StuartS
Date: February 22, 2006 at 10:25:04 Pacific
Subject: Countdown timer in VB6 |
Reply: (edit)Which is better - a 16 bit integer variable or a 64 bit Date variable? Which does a faster comparison - at an Integer or a Date variable. Personally, I would use a 16 bit variable. Foster, less overheads and simple to implement. Actually there is a small error in my original post. It should be 60000, not 6000. 6000 will only give a six second delay. 60000 will give a 1 minute delay. Stuart
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
Name: jhunt303
Date: February 23, 2006 at 08:31:20 Pacific
Subject: Countdown timer in VB6 |
Reply: (edit)You have a bit more control with DateTime variables, you can always convert the minute and seconds to an SByte. A neat trick is to increase the frequency of checking as you approach the value of time you need, this can lead to a very accurate event with minimized overhead. The count function is a little more appropriate for Thread timings
Report Offensive Follow Up For Removal
|
|
Response Number 5
|
Name: StuartS
Date: February 23, 2006 at 11:37:51 Pacific
Subject: Countdown timer in VB6 |
Reply: (edit)As the DateTime variable is only has resolution of one second and the Timer has a resolution of 1000th of a second, I dont see how using a DateTime variable can inprove on an Integer variable. You can just as easy increas the frequency of checking with an Integer variable. The only limitation is that you canot time events longer than around 22 days. 32767 /60 /24 Bear in mind that Date/Times are stored in Windows as a double precision floating point number. What's an Sbyte? Stuart
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: