| | |
Timer problems!
![]() |
•
•
Join Date: Oct 2005
Posts: 24
Reputation:
Solved Threads: 2
hi,
i am working on a program that locks your computer after a preset time, sort of like the type you would find in an internet cafe etc, but it doesnt work properly.
when its unlocked and a time enterd it passes the time (in minutes to a form that shows your time, the time is placed in a variable (minutevar), another variable (secondsvar) is set to 60 and a timer is run.
The timer counts down in 1000 ms increments and each time its sub is triggerd it subtracts 1 from the second variable (secondsvar) and then updates the display. it then subtracts 1 from the first variable (minutevar) IF secondsvar = 0 then it updates the display.
IF minutevar = 0 then it shows the Lock form and hides its self otherwise it continues.
the first time the timer is run, it works perfectly, the time is set, the timer counts down and it locks the computer when its supposed to, then when i try and unlock it again it unlocks the time is enterd and the timer set BUT the timer has frozen and no longer counts down, i have tried setting a breakpoint on the timer, it works the first time and breaks but the second time it doesnt break, which indicates to me that the timer isnt running.
If Anyone has any ideas on how to fix this problem please let me know, i can provide source code if needed in either text or file form.
i am working on a program that locks your computer after a preset time, sort of like the type you would find in an internet cafe etc, but it doesnt work properly.
when its unlocked and a time enterd it passes the time (in minutes to a form that shows your time, the time is placed in a variable (minutevar), another variable (secondsvar) is set to 60 and a timer is run.
The timer counts down in 1000 ms increments and each time its sub is triggerd it subtracts 1 from the second variable (secondsvar) and then updates the display. it then subtracts 1 from the first variable (minutevar) IF secondsvar = 0 then it updates the display.
IF minutevar = 0 then it shows the Lock form and hides its self otherwise it continues.
the first time the timer is run, it works perfectly, the time is set, the timer counts down and it locks the computer when its supposed to, then when i try and unlock it again it unlocks the time is enterd and the timer set BUT the timer has frozen and no longer counts down, i have tried setting a breakpoint on the timer, it works the first time and breaks but the second time it doesnt break, which indicates to me that the timer isnt running.
If Anyone has any ideas on how to fix this problem please let me know, i can provide source code if needed in either text or file form.
•
•
Join Date: Feb 2008
Posts: 7
Reputation:
Solved Threads: 1
i am also working with this type of coding to lock like in the cyber cafe,if u plz,give me ur full code then i can check this with my code and hope that we both success in this code can u mail me your code file on my id--- amit6sharma86@rediffmail.com
if i done this then i forward the correct code to you ok
if i done this then i forward the correct code to you ok
Hi,
Say, you want to lock the Computer, if there is no activity for 5 mins continus.. then you need to have a Timer.
Timer's Interval is 1000 ms(1 sec)
By Default Timer is enable all the time.
Declare a FormLevel Variable
MyVar as Integer.
Make Form's property Keypreview=True.
In KeyUp , KeyPress, MouseMove , MouseUp events of form, make
MyVar = 0
Timer1.Enabled = True
In Timer's Timer event Increment
MyVar = MyVar+1
If MyVar >= 300 Then
' Write Code To Lock the Computer here
Timer1.Enabled =False
MyVar = 0
End If
Regards
Veena
Say, you want to lock the Computer, if there is no activity for 5 mins continus.. then you need to have a Timer.
Timer's Interval is 1000 ms(1 sec)
By Default Timer is enable all the time.
Declare a FormLevel Variable
MyVar as Integer.
Make Form's property Keypreview=True.
In KeyUp , KeyPress, MouseMove , MouseUp events of form, make
MyVar = 0
Timer1.Enabled = True
In Timer's Timer event Increment
MyVar = MyVar+1
If MyVar >= 300 Then
' Write Code To Lock the Computer here
Timer1.Enabled =False
MyVar = 0
End If
Regards
Veena
![]() |
Similar Threads
- Tkinter Countdown Timer problems. (Python)
- Installing Windows XP Pro (Windows NT / 2000 / XP)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Debug & Code Window
- Next Thread: Binding to TDBList
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





