|
-
Nov 4th, 2000, 04:17 PM
#1
Thread Starter
The picture isn't missing
i want to have something happen every 30 minutes, like open iexplore. how do i do that
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Nov 4th, 2000, 04:29 PM
#2
Fanatic Member
Create a timer and set the interval to 60000. Now add this code to the general declarations section of your form:
Code:
Dim Minutes As Integer 'the number of minutes since the last 30 mins
And add this code to the Timer Event of the time
Code:
'add one to the counter
Minutes = Minutes + 1
'check if 30 is reached
If Minutes > 29 Then
'reset the counter
Minutes = 0
Msgbox "30 minutes are elapsed"
End If
-
Nov 4th, 2000, 05:46 PM
#3
Hyperactive Member
You could also use the GetTickCount API...
A bit more accurate
Code:
'Put in a module
Option Explicit
Private Declare Function GetTickCount& Lib "kernel32" ()
Public Sub Timed_Event(ByVal Interval As Long)
'Interval in minutes
Dim Start As Long
'Set Start of timer
Start = GetTickCount
'Check for to see if interval elapsed, else loop
Do While GetTickCount < Start + (Interval * 60000)
'allow other processes
DoEvents
Loop
'Your code goes here
End Sub
[Edited by dsy5 on 11-04-2000 at 05:49 PM]
-
Nov 4th, 2000, 08:59 PM
#4
No API/Timer needed.
Code:
Private Sub Command1_Click()
Time = "00:00:00"
Do
Time2 = Format(Time, "hh:nn:ss")
If Time2 = "00:30:00" Then MsgBox "Times up!": Exit Do
DoEvents
Loop
End Sub
[Edited by Matthew Gates on 11-05-2000 at 03:36 AM]
-
Nov 5th, 2000, 02:47 AM
#5
Fanatic Member
Originally posted by Matthew Gates
Code:
If Time2 = "00:29:00" Then MsgBox "Times up!":
I think you need to change 29 to 30.
-
Nov 5th, 2000, 03:41 AM
#6
Oops. The little things...
it was this line that I was looking at while writing the code:
If Minutes > 29 Then
So I was thinking 29. Don't know why.
Hope BuggyProgrammer get's the point anyway.
Nothing the little edit/delete image can't handle to fix the problem though .
-
Nov 5th, 2000, 08:51 AM
#7
Hyperactive Member
http://forums.vb-world.net/showthrea...threadid=20868
The dll raises events, so you don't have to use loops.
If you want it, give me a shout.
td.
"One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig
[email protected]
"but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.
-
Nov 5th, 2000, 11:29 AM
#8
Use the Timer function. It's similar to GetTickCount except it goes in intervals of 1000 ms rather than 1.
Code:
Sub NewTimer(ByVal Interval As Long)
Do
Start = Timer
Do While Timer < Start + Interval
DoEvents
Loop
Loop
End Sub
Usage:
Code:
'Start Timer in intervals of 30 min
NewTimer 1800
-
Nov 5th, 2000, 02:54 PM
#9
Hyperactive Member
or better, use SetTimer / KillTimer APIs
it calls the function u specify (one of the params is the adress of the func - use AddressOf) when the time interval has passed, and u dont have to have any loops - ppl can still use the app.
buzzwords are the language of fools
-
Nov 5th, 2000, 03:16 PM
#10
Thread Starter
The picture isn't missing
Remember, if someone's post was not helpful, you can always rate their post negatively  .
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
|