|
-
Apr 2nd, 2001, 02:50 PM
#1
Thread Starter
New Member
I need a way to design a timer, ranged from 1 to 10 minutes. On this same form I would need a control button to start a WinNT application. It would be preferred if the timer form was the only place the WinNT application could be started. After the application was started and it was idle until the timer had reached its preset value, then the timer should shut down the WinNT application. Then the operator could begin the process over again.
All help is appreciated.
Ron
-
Apr 2nd, 2001, 04:38 PM
#2
Addicted Member
needs 1 timer(timer1) and 1 command button (command1)
Code:
Private Sub Command1_Click()
'Code To Run App
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Static seconds&
Dim NumbOfMinutes&
NumbOfMinutes = 4 'change that
seconds = seconds + 1
If seconds = NumbOfMinutes * 60 Then
'code to close app
Timer1.Enabled = False
End If
End Sub
-
Apr 2nd, 2001, 06:38 PM
#3
Thread Starter
New Member
I believe this code will only permit the application to run until the timer has timed out. I need a timer which will stop the application if the application has been idle for the amount of time the timer was preset for. Perhaps a window handle could be used to drive a shut down sequence.
The application shut down timer may need to be initialized by another timer which is driven by either the mouse or keyboard being idle for a given period of time.
The logic would be:
Set predertimed timeouts ( 1 to 10 minutes )
Start application
Timer1 - sense no activity - time out, start Timer2
Timer2 - sense no activity - time out - stop application
Timer1 & Timer2 reset/clear
End
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
|