VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Make a program that shuts the computer down in a defined amount of time or defined date and time. T

by Ben (2 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 17th October 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Make a program that shuts the computer down in a defined amount of time or defined date and time. This program cannot be exited.

Rate Make a program that shuts the computer down in a defined amount of time or defined date and time. T



Private Sub Form_Load()
Timer1.Interval = 1
Form1.Visible = False
Form1.Tag = 0
End Sub
Private Sub Timer1_Timer()
Dim Type1 As Long
Dim Seconds As Long
Dim Minutes As Long
Dim Hours As Long
Dim Date1 As Date
Dim Time2Off As Long
Type1 = 1   'Set to 1 for countdown to shutdown, 0 for shutdown on date and time
Seconds = 0
Minutes = 0
Hours = 24 'Use the 24 hour clock
Date1 = #11/1/2000#
Time2Off = 300000 'Use time in milliseconds
If Type1 = 1 Then
Form1.Tag = Form1.Tag + 1
If Form1.Tag = Time2Off Then Call ExitWindowsEx(0 Or 1, 0)
Exit Sub
End If
If Type1 = 0 Then
x = Time$
y = Date$
a = Second(x)
b = Minute(x)
c = Hour(x)
If a = Seconds And b = Minutes And c = Hours And y = Date1 Then
Call ExitWindowsEx(0 Or 1, 0)
End If
Exit Sub
End If
End Sub
Private Sub Form_Unload(Cancel as Integer)
Cancel = 1
End Sub 

Download this snippet    Add to My Saved Code

Make a program that shuts the computer down in a defined amount of time or defined date and time. T Comments

No comments have been posted about Make a program that shuts the computer down in a defined amount of time or defined date and time. T. Why not be the first to post a comment about Make a program that shuts the computer down in a defined amount of time or defined date and time. T.

Post your comment

Subject:
Message:
0/1000 characters