Public Class LockWindow
Private Sub LockWindow_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
My.Settings.Reload()
If My.Settings.AllowClose = "True" Then
e.Cancel = False
My.Settings.AllowClose = "False"
Else
e.Cancel = True
End If
End Sub
Private Sub LockWindow_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LockSettings.Icon.Visible = False
My.Settings.Reload()
Me.WindowState = FormWindowState.Maximized
Me.TopMost = True
Dim FormHeight As String = Me.Height()
Dim FormWidth As String = Me.Width()
Dim Login_Box_Height As String = Login_Box.Height()
Dim Login_Box_Width As String = Login_Box.Width()
Login_Box.Location = New Point(x:=(Val(FormWidth) / Val(2)) - (Val(Login_Box_Width) / Val(2)), y:=(Val(FormHeight) / Val(2)) - (Val(Login_Box_Height) / Val(2)))
If My.Settings.HidePassword = "True" Then
Password.UseSystemPasswordChar = True
Else
Password.UseSystemPasswordChar = False
End If
If My.Settings.UseImage = "True" Then
If My.Settings.UseOwnImage = "True" Then
LockPicture.ImageLocation = My.Settings.OwnImage
Else
If My.Settings.PreImage = "Lighting" Then
LockPicture.Image = My.Resources.Lighting
End If
If My.Settings.PreImage = "Background" Then
LockPicture.Image = My.Resources.Background
End If
If My.Settings.PreImage = "Stars" Then
LockPicture.Image = My.Resources.Background_Stars
End If
If My.Settings.PreImage = "Blue Background" Then
LockPicture.Image = My.Resources.Blue_Background
End If
If My.Settings.PreImage = "Business" Then
LockPicture.Image = My.Resources.Business
End If
If My.Settings.PreImage = "Colourful" Then
LockPicture.Image = My.Resources.Colourful
End If
If My.Settings.PreImage = "Fire" Then
LockPicture.Image = My.Resources.Fire
End If
If My.Settings.PreImage = "Alienware" Then
LockPicture.Image = My.Resources.Alienware
End If
If My.Settings.PreImage = "Brazil - Rio de Janeiro" Then
LockPicture.Image = My.Resources.Brazil___Rio_de_Janeiro
End If
If My.Settings.PreImage = "Eiffel Tower Night" Then
LockPicture.Image = My.Resources.Eiffel_Tower__Night
End If
If My.Settings.PreImage = "Fighter Jet" Then
LockPicture.Image = My.Resources.Fighter_jet
End If
If My.Settings.PreImage = "Fiji" Then
LockPicture.Image = My.Resources.Fiji
End If
If My.Settings.PreImage = "Great Wall of China" Then
LockPicture.Image = My.Resources.Great_Wall_of_China
End If
If My.Settings.PreImage = "Microsoft Windows XP Gold" Then
LockPicture.Image = My.Resources.Microsoft_Windows_XP_Gold
End If
If My.Settings.PreImage = "San Francisco's Golden Gate Bridge" Then
LockPicture.Image = My.Resources.San_Francisco_s_Golden_Gate_bridge_at_night
End If
If My.Settings.PreImage = "Vista Eclipse" Then
LockPicture.Image = My.Resources.Vista_Eclipse
End If
If My.Settings.PreImage = "Vista Themes" Then
LockPicture.Image = My.Resources.Vista_Themes
End If
If My.Settings.PreImage = "Windows Vista Aqua" Then
LockPicture.Image = My.Resources.Windows_Vista_Aqua
End If
End If
Else
End If
Me.KeyPreview = True
If My.Settings.ShowHideButton = "True" Then
LoginHide.Visible = True
End If
If My.Settings.ShowHideButton = "False" Then
LoginHide.Visible = False
End If
End Sub
Private Sub Unlock_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Unlock_Button.Click
My.Settings.Reload()
Dim Time = TimeOfDay
Dim Today = DateString
My.Settings.Reload()
If Password.Text = My.Settings.AdminPassword Then
My.Settings.AllowClose = "True"
My.Settings.Save()
Me.Close()
Settings.Enabled = False
Me.TopMost = False
LockSettings.Icon.Visible = True
Else
If My.Settings.PlaySiren = "True" Then
My.Computer.Audio.Play(My.Resources.Alarm_Signal, AudioPlayMode.Background)
End If
If My.Settings.ShowUnsuccessfulAttempts = "True" Then
Unsuccessful_Attempts.Show()
Unsuccessful_Attempts.AttemptsList.Items.Add(Today + ", " + Time + ", Unsuccessful Attempt")
End If
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginHide.Click
Login_Box.Visible = False
ShowLogin.Enabled = True
End Sub
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.F12 Then
Else
Login_Box.Visible = True
End If
If e.KeyCode = Keys.Enter Then
My.Settings.Reload()
Dim Time = TimeOfDay
Dim Today = DateString
My.Settings.Reload()
If Password.Text = My.Settings.AdminPassword Then
My.Settings.AllowClose = "True"
My.Settings.Save()
TimedLock.Close()
Me.Close()
Settings.Enabled = False
Me.TopMost = False
LockSettings.Icon.Visible = True
Else
My.Computer.Audio.Play(My.Resources.Alarm_Signal, AudioPlayMode.Background)
If My.Settings.ShowUnsuccessfulAttempts = "True" Then
Unsuccessful_Attempts.Show()
Unsuccessful_Attempts.AttemptsList.Items.Add(Today + ", " + Time + ", Unsuccessful Attempt")
End If
End If
End If
End Sub
Private Sub Settings_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Settings.Tick
Me.TopMost = True
End Sub
Private Sub Mouse_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Mouse.Tick
Dim MousePositionX As Integer = Cursor.Position.X
Dim MousePositionY As Integer = Cursor.Position.Y
If MousePositionX > 1181 Then
Windows.Forms.Cursor.Position = New Point(1181, MousePositionY)
End If
If MousePositionX < 739 Then
Windows.Forms.Cursor.Position = New Point(739, MousePositionY)
End If
If MousePositionY < 526 Then
Windows.Forms.Cursor.Position = New Point(MousePositionX, 526)
End If
If MousePositionY > 672 Then
Windows.Forms.Cursor.Position = New Point(MousePositionX, 672)
End If
End Sub
Private sleep As Integer = 1
Private mousehidden As Boolean = False
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If sleep > 0 Then
sleep -= 1
Else
mousehidden = True
Cursor.Hide()
Timer1.Stop()
End If
End Sub
Private Sub LockWindow_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If mousehidden = True Then
Cursor.Show()
sleep = 10
mousehidden = False
Timer1.Interval = 100
Timer1.Start()
End If
End Sub
End Class