|
-
Aug 28th, 2000, 07:57 AM
#1
Thread Starter
Fanatic Member
I know many programing languages like c++ delphi and so on, but I just started visual basic a month ago and noticed that you can not set the timer value to 600000 (ten minutes). Is there a way to set it to 10 minutes?
Visual Basic 6.0
Visual C++ 5
Delphi 5

-
Aug 28th, 2000, 08:12 AM
#2
Fanatic Member
There is a basic workaround:
Code:
Private Sub Timer1_Timer()
Static TenMinutesPassed As Boolean
If Not(TenMinutesPassed) Then
Timer1.Enabled = False
Timer1.Enabled = true
Else:
'Code here fires after approx twenty minutes
Timer1.Enabled = False
End If
End Sub
For more than twenty minutes:
Code:
Private Sub Timer1_Timer()
Static TimesReached As Integer
TimesReached = TimesReached + 1
If TimesReached <= 6 Then
Timer1.Enabled = False
Timer1.Enabled = True
Else:
'Code here fires after approx 1 hr
Timer1.Enabled = False
End If
You could, once you get used to VB, make your own timer control, but for now the code above should do.
Enough gay banter,
good bye
-
Aug 28th, 2000, 08:21 AM
#3
Thread Starter
Fanatic Member
I'd rather make my own timer one way or another. If any1 know a simple way to make a timer that can have an interval of over 10 minutes, then reply please. Thanks, your help is appreciated!!!
Visual Basic 6.0
Visual C++ 5
Delphi 5

-
Aug 28th, 2000, 08:36 AM
#4
Fanatic Member
-
Aug 28th, 2000, 08:54 AM
#5
Fanatic Member
The timers in VB can be set to a max of 65,535 milliseconds, or just over 65 seconds.
I needed a way to allow the user to set the time intervals at any value, up to 15 minutes.
So, create a timer. When you start the timer, save the current time in a variable. Set the timers interval to 60,000 so it will check the current time every minute. In the timer subroutine, just check the elapsed time that has passed.
When the chosen amount of time has passed, reset the variable and that will start your count over again.
I do not have any beautiful code to post, but if you need more information I will see if I can set something up.
-
Aug 28th, 2000, 08:58 AM
#6
Frenzied Member
api baby
api - you can rewrite windows with them (of course it will crash cus ms made the api functions)
but back to the topic - use the api calls like VERY suggested
-
Aug 28th, 2000, 09:01 AM
#7
Fanatic Member
I like V(ery) Basic's suggestion also. Looks a lot cleaner. Putting it into my code now.
If all else fails, API it.
-
Aug 28th, 2000, 01:08 PM
#8
Try this. (No API needed)
Code:
Dim bTime As Boolean
Sub TimerEx(lTime As Integer)
Do While bTime = True
Start = Timer
Do While Timer < Start + lTime
DoEvents
Loop
'<--Place your code here-->
Loop
End Sub
Private Sub Command1_Click()
'Start timer (for 10 minutes)
bTime = True
TimerEx 600
End Sub
Private Sub Command2_Click()
'Stop timer
bTime = False
End Sub
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
|