Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Lockscreen with Keypad | Source

This is my first post and release here and also the first project of this kind. This is just a lockscreen with keypad, the idea I took from rainmeter, there you can't do a keyboard hook or close a process, and this blocks all keys except ctrl+alt+delete and winkey+l but it dose close task manager. This is how it looks like:



Keep in mind that all pictures can be changed from the external folder with images.

Credits: Me and DarthDestroyer

I am far from an expert with vb.net, so here is the source with binary: Download Link (File updated v1.1)

Update:
v1.0
-initial release
v1.1
-optimized timer for closing processes (crdits: DarthDestroyer)
-added keyboard numbers exception (credits: DarthDestroyer)
-other updates
-posible last version, check page 2-3 for any update
v1.2
version not working properly because of an error in button gui
-gui buttons added (credits: DarthDestroyer)
-other small changes (font, time format, etc...)

Special thx to DarthDestroyer
Would look better centered bro, other than that, good job
It is centered, fullscreen (I recorded like that) and It adds a form, fullscreen too, on any other display with just the time, oh and the encryption for the code is made by me, I know is not much of an encryption but I try
Nice share bro! Will use it on my notebook! :)
[Image: R1GHGIZ.jpg]
the idea is nice but why images u can do it with gdi
This is a funny Way to optain, what you want... ;)

I have two fast suggestions for you...

1. You forgot to set the FrmScreen DoubleBuffered Option ;)
2. You could optimize the CloseTimer a Lot! It's not necessary that you loop (for each) multiple times through the ProcessList...

And... then... A Hint: Why not allow the Numbers from the Keyboard? ;)

I like it! Good Job!
(Aug 11, 2014 06:54 AM)Only3 Wrote:  the idea is nice but why images u can do it with gdi

I know that its posible but I don't know exacly how so I did the way I did it, but if you want to do it I will be happy to add it and give you the credit

(Aug 11, 2014 08:08 AM)DarthDestroyer Wrote:  This is a funny Way to optain, what you want... ;)

I have two fast suggestions for you...

1. You forgot to set the FrmScreen DoubleBuffered Option ;)
2. You could optimize the CloseTimer a Lot! It's not necessary that you loop (for each) multiple times through the ProcessList...

And... then... A Hint: Why not allow the Numbers from the Keyboard? ;)

I like it! Good Job!

Yea I know its not the best way to do it but if you got a better way and want to add it I will be happy to use it, give you the credit of course
Oh and it was easier to block everything
OK... here we go...

TimerClose Example:

Code
Private Sub TimerClose_Tick(sender As Object, e As EventArgs) Handles TimerClose.Tick
      Try
      For Each prog As Process In Process.GetProcesses
            Select Case prog.ProcessName
            Case "Taskmgr"
            prog.Kill()
            Case "taskmgr"
            prog.Kill()
            Case "cmd"
            prog.Kill()
            Case "bsplayer"
            prog.Kill()
            Case "vlc"
            prog.Kill()
            Case "chrome"
            prog.Kill()
            Case "firefox"
            prog.Kill()
            Case "iexplore"
            prog.Kill()
            Case "opera"
            prog.Kill()
            End Select
      Next
      Catch ex As Exception
      End Try
    End Sub

KeyboardHook_KeyUp Example:

Code
Private Sub AddKeyToLabelCode(ByVal input As String)
      If Not LabelCode.Text.Length > 9 Then
      LabelCode.Text &= input
      End If
    End Sub

Private Sub KeyboardHook_KeyUp(sender As Object, e As KeyEventArgs) Handles KeyboardHook.KeyUp
      Select Case e.KeyData
      Case Keys.D1
            AddKeyToLabelCode("1")
      Case Keys.NumPad1
            AddKeyToLabelCode("1")
      Case Keys.D2
            AddKeyToLabelCode("2")
      Case Keys.NumPad2
            AddKeyToLabelCode("2")
      Case Keys.D3
            AddKeyToLabelCode("3")
      Case Keys.NumPad3
            AddKeyToLabelCode("3")
      Case Keys.D4
            AddKeyToLabelCode("4")
      Case Keys.NumPad4
            AddKeyToLabelCode("4")
      Case Keys.D5
            AddKeyToLabelCode("5")
      Case Keys.NumPad5
            AddKeyToLabelCode("5")
      Case Keys.D6
            AddKeyToLabelCode("6")
      Case Keys.NumPad6
            AddKeyToLabelCode("6")
      Case Keys.D7
            AddKeyToLabelCode("7")
      Case Keys.NumPad7
            AddKeyToLabelCode("7")
      Case Keys.D8
            AddKeyToLabelCode("8")
      Case Keys.NumPad8
            AddKeyToLabelCode("8")
      Case Keys.D9
            AddKeyToLabelCode("9")
      Case Keys.NumPad9
            AddKeyToLabelCode("9")
      Case Keys.Enter
            PerformCheck()
      Case Else
            e.Handled = True
      End Select
    End Sub

AND... because i had some time... a little Gift:

Your ImageThingie as a GDI Button:

Code
Public Class PiCButton
    Inherits Control

    Enum MouseState As Byte
      None = 0
      Over = 1
      Down = 2
      Block = 3
    End Enum

    Private _BorderColour As Color = Color.FromArgb(255, 255, 255)
    Private _FontColour As Color = Color.FromArgb(255, 255, 255)
    Private _FontHoverColour As Color = Color.FromArgb(255, 255, 255)
    Private _FontClickColour As Color = Color.FromArgb(255, 255, 255)
    Private _MainColour As Color = Color.Transparent
    Private _HoverColour As Color = Color.FromArgb(85, 255, 255, 255)
    Private _PressedColour As Color = Color.FromArgb(85, 0, 0, 0)
    Private _OffSetLeft As Integer = 0
    Private _OffSetTop As Integer = 0
    Private State As New MouseState

    Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
      MyBase.OnMouseDown(e)
      State = MouseState.Down : Invalidate()
    End Sub
    Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
      MyBase.OnMouseUp(e)
      State = MouseState.Over : Invalidate()
    End Sub
    Protected Overrides Sub OnMouseEnter(e As EventArgs)
      MyBase.OnMouseEnter(e)
      State = MouseState.Over : Invalidate()
    End Sub
    Protected Overrides Sub OnMouseLeave(e As EventArgs)
      MyBase.OnMouseLeave(e)
      State = MouseState.None : Invalidate()
    End Sub

    <Category("Colours")>
    Public Property BorderColour As Color
      Get
      Return _BorderColour
      End Get
      Set(value As Color)
      _BorderColour = value
      Invalidate()
      End Set
    End Property

    <Category("Colours")>
    Public Property FontColour As Color
      Get
      Return _FontColour
      End Get
      Set(value As Color)
      _FontColour = value
      Invalidate()
      End Set
    End Property

    <Category("Colours")>
    Public Property FontHoverColour As Color
      Get
      Return _FontHoverColour
      End Get
      Set(value As Color)
      _FontHoverColour = value
      Invalidate()
      End Set
    End Property

    <Category("Colours")>
    Public Property FontClickColour As Color
      Get
      Return _FontClickColour
      End Get
      Set(value As Color)
      _FontClickColour = value
      Invalidate()
      End Set
    End Property

    <Category("Colours")>
    Public Property BaseColour As Color
      Get
      Return _MainColour
      End Get
      Set(value As Color)
      _MainColour = value
      Invalidate()
      End Set
    End Property

    <Category("Colours")>
    Public Property HoverColour As Color
      Get
      Return _HoverColour
      End Get
      Set(value As Color)
      _HoverColour = value
      Invalidate()
      End Set
    End Property

    <Category("Colours")>
    Public Property PressedColour As Color
      Get
      Return _PressedColour
      End Get
      Set(value As Color)
      _PressedColour = value
      Invalidate()
      End Set
    End Property

    <Category("OffSet")>
    Public Property OffSetLeft As Integer
      Get
      Return _OffSetLeft
      End Get
      Set(value As Integer)
      _OffSetLeft = value
      Invalidate()
      End Set
    End Property

    <Category("OffSet")>
    Public Property OffSetTop As Integer
      Get
      Return _OffSetTop
      End Get
      Set(value As Integer)
      _OffSetTop = value
      Invalidate()
      End Set
    End Property

    Sub New()
      SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
            ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
            ControlStyles.SupportsTransparentBackColor, True)
      DoubleBuffered = True
      Font = New Font("Arial", 30)
      Size = New Size(50, 50)
      MaximumSize = New Size(50, 50)
      MinimumSize = New Size(50, 50)
      BackColor = _MainColour
    End Sub

    Protected Overrides Sub OnPaint(e As PaintEventArgs)
      Dim G = e.Graphics
      Dim FontBrush As Brush = Brushes.White
      With G
      .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
      .SmoothingMode = SmoothingMode.HighQuality
      .PixelOffsetMode = PixelOffsetMode.HighQuality
      .InterpolationMode = CType(7, InterpolationMode)
      Select Case State
            Case MouseState.None
            FontBrush = Brushes.White
            .DrawEllipse(New Pen(_BorderColour, 2), New Rectangle(2, 2, Width - 4, Height - 4))
            Case MouseState.Over
            FontBrush = Brushes.White
            .FillEllipse(New SolidBrush(_HoverColour), New Rectangle(2, 2, Width - 4, Height - 4))
            .DrawEllipse(New Pen(_BorderColour, 2), New Rectangle(2, 2, Width - 4, Height - 4))
            Case MouseState.Down
            FontBrush = Brushes.White
            .FillEllipse(New SolidBrush(_PressedColour), New Rectangle(2, 2, Width - 4, Height - 4))
            .DrawEllipse(New Pen(_BorderColour, 2), New Rectangle(2, 2, Width - 4, Height - 4))
      End Select
      .DrawString(Text, Font, FontBrush, New Point(CInt((Width - 4) / 2) + _OffSetLeft, CInt((Height + 4) / 2) + _OffSetTop), New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
      End With
    End Sub

End Class

It should explain itself...

For your Reset and Confirm Button, user "Webdings"-Font ;)

I had remade your entire Code... i would post it, if you want ✌
(Aug 12, 2014 01:45 AM)DarthDestroyer Wrote:  SNIPPED :D

Awesome HQ post. You seem to be a good coder, you should release some of your stuff. I would love to see it.

Enjoy the green apple.
Nice work ;) Keep up the good work ;)
BTC - bc1q3efew3yzfwhdz290dafykaw0a2w56g2j69g2c6
ETH - 0xf1c873217032468990D3313da6509D1b813c4671
USDT - 0xf1c873217032468990D3313da6509D1b813c4671
PP - [email protected]
Thank you, Mate!

I'm happy, that you like it... 🤗

I can't Release something atm. I code for a Company only, atm.
These Solutions require an Active Directory or a SQL Server...

The only thing, that i could Release is an SEPA-XML Reader without Dependencies in German Language... I dont know, if it would be userfull for you 😅

BTT: I have uploaded the changed Files! http://www.mediafire.com/download/voueg3...Numpad.rar

In this Archive are only the Files for the Main-From! Nothing else!
I hadn't spend a lot of time in the functionality, but it "should" work 🤣
(Aug 12, 2014 01:45 AM)DarthDestroyer Wrote:  OK... here we go...

TimerClose Example:

Code
Private Sub TimerClose_Tick(sender As Object, e As EventArgs) Handles TimerClose.Tick
      Try
      For Each prog As Process In Process.GetProcesses
      Select Case prog.ProcessName
      Case "Taskmgr"
      prog.Kill()
      Case "taskmgr"
      prog.Kill()
      Case "cmd"
      prog.Kill()
      Case "bsplayer"
      prog.Kill()
      Case "vlc"
      prog.Kill()
      Case "chrome"
      prog.Kill()
      Case "firefox"
      prog.Kill()
      Case "iexplore"
      prog.Kill()
      Case "opera"
      prog.Kill()
      End Select
      Next
      Catch ex As Exception
      End Try
    End Sub

KeyboardHook_KeyUp Example:

Code
Private Sub AddKeyToLabelCode(ByVal input As String)
      If Not LabelCode.Text.Length > 9 Then
      LabelCode.Text &= input
      End If
    End Sub

Private Sub KeyboardHook_KeyUp(sender As Object, e As KeyEventArgs) Handles KeyboardHook.KeyUp
      Select Case e.KeyData
      Case Keys.D1
      AddKeyToLabelCode("1")
      Case Keys.NumPad1
      AddKeyToLabelCode("1")
      Case Keys.D2
      AddKeyToLabelCode("2")
      Case Keys.NumPad2
      AddKeyToLabelCode("2")
      Case Keys.D3
      AddKeyToLabelCode("3")
      Case Keys.NumPad3
      AddKeyToLabelCode("3")
      Case Keys.D4
      AddKeyToLabelCode("4")
      Case Keys.NumPad4
      AddKeyToLabelCode("4")
      Case Keys.D5
      AddKeyToLabelCode("5")
      Case Keys.NumPad5
      AddKeyToLabelCode("5")
      Case Keys.D6
      AddKeyToLabelCode("6")
      Case Keys.NumPad6
      AddKeyToLabelCode("6")
      Case Keys.D7
      AddKeyToLabelCode("7")
      Case Keys.NumPad7
      AddKeyToLabelCode("7")
      Case Keys.D8
      AddKeyToLabelCode("8")
      Case Keys.NumPad8
      AddKeyToLabelCode("8")
      Case Keys.D9
      AddKeyToLabelCode("9")
      Case Keys.NumPad9
      AddKeyToLabelCode("9")
      Case Keys.Enter
      PerformCheck()
      Case Else
      e.Handled = True
      End Select
    End Sub

AND... because i had some time... a little Gift:

Your ImageThingie as a GDI Button:

Code
Public Class PiCButton
    Inherits Control

    Enum MouseState As Byte
      None = 0
      Over = 1
      Down = 2
      Block = 3
    End Enum

    Private _BorderColour As Color = Color.FromArgb(255, 255, 255)
    Private _FontColour As Color = Color.FromArgb(255, 255, 255)
    Private _FontHoverColour As Color = Color.FromArgb(255, 255, 255)
    Private _FontClickColour As Color = Color.FromArgb(255, 255, 255)
    Private _MainColour As Color = Color.Transparent
    Private _HoverColour As Color = Color.FromArgb(85, 255, 255, 255)
    Private _PressedColour As Color = Color.FromArgb(85, 0, 0, 0)
    Private _OffSetLeft As Integer = 0
    Private _OffSetTop As Integer = 0
    Private State As New MouseState

    Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
      MyBase.OnMouseDown(e)
      State = MouseState.Down : Invalidate()
    End Sub
    Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
      MyBase.OnMouseUp(e)
      State = MouseState.Over : Invalidate()
    End Sub
    Protected Overrides Sub OnMouseEnter(e As EventArgs)
      MyBase.OnMouseEnter(e)
      State = MouseState.Over : Invalidate()
    End Sub
    Protected Overrides Sub OnMouseLeave(e As EventArgs)
      MyBase.OnMouseLeave(e)
      State = MouseState.None : Invalidate()
    End Sub

    <Category("Colours")>
    Public Property BorderColour As Color
      Get
      Return _BorderColour
      End Get
      Set(value As Color)
      _BorderColour = value
      Invalidate()
      End Set
    End Property

    <Category("Colours")>
    Public Property FontColour As Color
      Get
      Return _FontColour
      End Get
      Set(value As Color)
      _FontColour = value
      Invalidate()
      End Set
    End Property

    <Category("Colours")>
    Public Property FontHoverColour As Color
      Get
      Return _FontHoverColour
      End Get
      Set(value As Color)
      _FontHoverColour = value
      Invalidate()
      End Set
    End Property

    <Category("Colours")>
    Public Property FontClickColour As Color
      Get
      Return _FontClickColour
      End Get
      Set(value As Color)
      _FontClickColour = value
      Invalidate()
      End Set
    End Property

    <Category("Colours")>
    Public Property BaseColour As Color
      Get
      Return _MainColour
      End Get
      Set(value As Color)
      _MainColour = value
      Invalidate()
      End Set
    End Property

    <Category("Colours")>
    Public Property HoverColour As Color
      Get
      Return _HoverColour
      End Get
      Set(value As Color)
      _HoverColour = value
      Invalidate()
      End Set
    End Property

    <Category("Colours")>
    Public Property PressedColour As Color
      Get
      Return _PressedColour
      End Get
      Set(value As Color)
      _PressedColour = value
      Invalidate()
      End Set
    End Property

    <Category("OffSet")>
    Public Property OffSetLeft As Integer
      Get
      Return _OffSetLeft
      End Get
      Set(value As Integer)
      _OffSetLeft = value
      Invalidate()
      End Set
    End Property

    <Category("OffSet")>
    Public Property OffSetTop As Integer
      Get
      Return _OffSetTop
      End Get
      Set(value As Integer)
      _OffSetTop = value
      Invalidate()
      End Set
    End Property

    Sub New()
      SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
      ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
      ControlStyles.SupportsTransparentBackColor, True)
      DoubleBuffered = True
      Font = New Font("Arial", 30)
      Size = New Size(50, 50)
      MaximumSize = New Size(50, 50)
      MinimumSize = New Size(50, 50)
      BackColor = _MainColour
    End Sub

    Protected Overrides Sub OnPaint(e As PaintEventArgs)
      Dim G = e.Graphics
      Dim FontBrush As Brush = Brushes.White
      With G
      .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
      .SmoothingMode = SmoothingMode.HighQuality
      .PixelOffsetMode = PixelOffsetMode.HighQuality
      .InterpolationMode = CType(7, InterpolationMode)
      Select Case State
      Case MouseState.None
      FontBrush = Brushes.White
      .DrawEllipse(New Pen(_BorderColour, 2), New Rectangle(2, 2, Width - 4, Height - 4))
      Case MouseState.Over
      FontBrush = Brushes.White
      .FillEllipse(New SolidBrush(_HoverColour), New Rectangle(2, 2, Width - 4, Height - 4))
      .DrawEllipse(New Pen(_BorderColour, 2), New Rectangle(2, 2, Width - 4, Height - 4))
      Case MouseState.Down
      FontBrush = Brushes.White
      .FillEllipse(New SolidBrush(_PressedColour), New Rectangle(2, 2, Width - 4, Height - 4))
      .DrawEllipse(New Pen(_BorderColour, 2), New Rectangle(2, 2, Width - 4, Height - 4))
      End Select
      .DrawString(Text, Font, FontBrush, New Point(CInt((Width - 4) / 2) + _OffSetLeft, CInt((Height + 4) / 2) + _OffSetTop), New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
      End With
    End Sub

End Class

It should explain itself...

For your Reset and Confirm Button, user "Webdings"-Font ;)

I had remade your entire Code... i would post it, if you want ✌

Yea sure post it, I like to see what else you done with the code


New version added with small changes
(Aug 12, 2014 04:10 AM)CottleSilver Wrote:  Yea sure post it, I like to see what else you done with the code


New version added with small changes

http://www.mediafire.com/download/voueg3...Numpad.rar ✌

I had started with your idea...
You could use ONE of these Btn-Images and draw the Text on it with the Btn_Paint Event...
Then, the User has to change only one Image...

The Idea with these GDI Buttons is, that they have Alpha-Enabled Colors. That means, that they are transparent. The User can choose any Background, but dont need to change the whole Buttons. I had done that too, with the "one-image"-idea...

http://www.mediafire.com/view/d9ug2err5obuyxq/Btn.png#

Another Idea is, you could use a Config-File (for User-Edits) where you can select, which form the button should have... Its Easy to implement more forms for the buttons! Rectangle, Ellipse, Polygon... Whatever you want! It would be easier for Users to change a line of text instead of drawing hours. 😅
Or... you could implement BOTH Versions ;)
Nice work man! Keep it up! And thanks for source! :)
Check out my projects on my website:
https://www.dev-offcode.com/
The last source has an error at the button gui, it will be updated in the next half hour


App downgraded to v1.1, posible fix for v1.2 will come soon


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by denemedeneme1Apr 4, 2016 01:07 PM 5 238 Apr 4, 2016 01:07 PM
Last Post: denemedeneme1
[Shell] by Ego IncSep 2, 2013 01:12 AM 2 146 Sep 2, 2013 01:12 AM
Last Post: Ego Inc
[C#] by Ben MitchJul 22, 2013 01:44 PM 0 161 Jul 22, 2013 01:44 PM
Last Post: Ben Mitch