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

.NET 

Lockscreen with Keypad | Source

(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 ✌

u know u can use array foreach which save ur hard coding select case
Array.ForEach({"taskmgr", "cmd", ...}, Sub(p) Process.GetProcessesByName(p)(0).Kill())
(Aug 12, 2014 06:00 AM)CottleSilver Wrote:  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

When you explain your "Error", we could help ✌

@Only3 - Another great Way! 👍 You will never stop learning! THX
just set lato font that you have with the .rar downloaded to the gui buttons made by you and wait, press a button or two and the app makes the error, is on OnPaint sub, the last row, the one with .DrawString(Text, Font...., something about something being used already
Thanks for sharing it, really useful!
(Aug 12, 2014 09:22 AM)CottleSilver Wrote:  just set lato font that you have with the .rar downloaded to the gui buttons made by you and wait, press a button or two and the app makes the error, is on OnPaint sub, the last row, the one with .DrawString(Text, Font...., something about something being used already

I don't have any Errors... 😵

But i had done some Changes on my Ideas...
Added a Custom Label with a nice shadow.
(Not Perfect - because i hadn't the time to add a "center" option atm)

I moved every File into the Executable's Resources - The Font too!
- The DLL, needs some more work - I dont know the Details about it - Probably unmanaged and that needs a little bit more work @ApplicationEvents

The GDI Button got further Updates (Form Selection)
- The Rotation of the Triangle is a little bit buggy... because the time...

The Passcode is stored in the App-Settings = no Textfile required
(i hadn't changed the SetCode App!!!)

The Upload is here: http://www.mediafire.com/download/ms9m21...screen.rar
There is no need (IMHO) for a viruscheck - only the source is included... you know what to do!

I give you my Status, because i will give you Feedback and Suggestions for your work.

For me, i bet, that a GDI Master will help here (With the Center and the Rotation Problem)... I'm not that Pro in that... Maybe there is a way for a button-shadow, too!?

I will not Release my Version on my own! I made this, for your Assistance!
It is your Idea ✌

And hey... Make a Screenshot from Errors or Copy the Text 😅 That would help 😉
I'm working with a german Visual Studio... The Sentence: "The Error-Message contains: blabla" is very difficult to track for me 😊
I made something very similar but without the fancy pass code thingo. I'm gonna test to see how secure yours is.
(Aug 13, 2014 02:05 AM)DarthDestroyer Wrote:  I don't have any Errors... 😵

But i had done some Changes on my Ideas...
Added a Custom Label with a nice shadow.
(Not Perfect - because i hadn't the time to add a "center" option atm)

I moved every File into the Executable's Resources - The Font too!
- The DLL, needs some more work - I dont know the Details about it - Probably unmanaged and that needs a little bit more work @ApplicationEvents

The GDI Button got further Updates (Form Selection)
- The Rotation of the Triangle is a little bit buggy... because the time...

The Passcode is stored in the App-Settings = no Textfile required
(i hadn't changed the SetCode App!!!)

The Upload is here: http://www.mediafire.com/download/ms9m21...screen.rar
There is no need (IMHO) for a viruscheck - only the source is included... you know what to do!

I give you my Status, because i will give you Feedback and Suggestions for your work.

For me, i bet, that a GDI Master will help here (With the Center and the Rotation Problem)... I'm not that Pro in that... Maybe there is a way for a button-shadow, too!?

I will not Release my Version on my own! I made this, for your Assistance!
It is your Idea ✌

And hey... Make a Screenshot from Errors or Copy the Text 😅 That would help 😉
I'm working with a german Visual Studio... The Sentence: "The Error-Message contains: blabla" is very difficult to track for me 😊

I took your version and modify only one thing, I made the label with the code on center, it looks better. This is my last version: Source, Binary.
Oh and you can you this: Packer, to get the dll inside a exe, just replace inside 'pack.bat' the name of the exe, dll and full path (folder not file).
And if you want you can release this, I can't edit my first post and it seems a good idea to start a new thread with the app working alot better, I will post in you thread that I wanted you to do it (it's really a bad idea do to C&P on this forum from what I read and who can blame?), you did alot of code yourself so why not get 50% if not more of the credit 🤝

PS: with the last version there is no error

Looking forward working with again 🤝 🤝
(Aug 13, 2014 03:59 AM)CottleSilver Wrote:  I took your version and modify only one thing, I made the label with the code on center, it looks better.

Had i missed there something?! Oha 😊 Thanks! 👍

(Aug 13, 2014 03:59 AM)CottleSilver Wrote:  Looking forward working with again 🤝🤝

Yeah... It was Fun 👍 Your Welcome!

======
The Thing with the Packer is: You have to do another Step... i dont like that Way...

It is not impossible to include unmanaged DLLs with Resources... But it needs some time...
Maybe anyone has coded something for that, but i dont want to spend to much time for that little thing...

I like the "one-single-executable"-Way... ;-)
I found how to add a dll in the exe:

Add the desired assembly to the project's resources.
Go to the Resources tab of the Project Properties and choose Add Resource > Add Existing File...
Switch to the Application tab and click on the View Application Events button.
Add this code to the ApplicationEvents.vb code that opens.
Code
Private Sub AppStart(ByVal sender As Object,
  ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
    AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf ResolveAssemblies
End Sub

Private Function ResolveAssemblies(sender As Object, e As System.ResolveEventArgs) As Reflection.Assembly
    Dim desiredAssembly = New Reflection.AssemblyName(e.Name)

    If desiredAssembly.Name = "the name of your assembly" Then
      Return Reflection.Assembly.Load(My.Resources.STDLIB) 'replace with your assembly's resource name
    Else
      Return Nothing
    End If
End Function

Now compile your project and you'll have the dependent assembly incorporated into the output as a single file.

Here's the original link: http://stackoverflow.com/questions/10025...-in-vb-net

I'll probably do it my self in a couple of hours if you didn't do it already, I'm working on the next project
Hey... did you look into the Resources?

The Problem with this Methode: it will only inlcude managed DLLs.
For unmanaged DLLs, it needs additional coding!

My Test was with:

Code
Private WithEvents DLLDomain As AppDomain = AppDomain.CurrentDomain
      Private Function DLL_AssemblyResolve(ByVal sender As Object, ByVal args As System.ResolveEventArgs) As System.Reflection.Assembly Handles DLLDomain.AssemblyResolve
      If args.Name.Contains("KeyboardHook") Then
      Return System.Reflection.Assembly.Load(My.Resources.KeyboardHook)
Else
      Return Nothing
      End If
      End Function

I find this Way a little bit better, because the Event-Binding ;)

Found some Informations: http://www.codeproject.com/Articles/5281...d-Resource
I wont steal your source. I wanna do this myself. Just wanted to say thanks for the idea :)
“Reality is just a crutch for people who can't handle drugs.” ― Robin Williams
Downloaded it the other day and tested it out... not too bad I must admit. I started working on it and made some huge improvements :) Adding a bunch more stuff just to see how far I'll go with this before I get bored and abandon it LoL -- Thanks for sharing this though.... gave me something to do :)
Great release man :) nice and useful app
(Aug 13, 2014 09:13 AM)sp4ceRH1N0 Wrote:  I wont steal your source. I wanna do this myself. Just wanted to say thanks for the idea :)

Not really stealing if he is giving it out ;)
(Aug 14, 2014 02:45 PM)nuk Wrote:  Downloaded it the other day and tested it out... not too bad I must admit. I started working on it and made some huge improvements :) Adding a bunch more stuff just to see how far I'll go with this before I get bored and abandon it LoL -- Thanks for sharing this though.... gave me something to do :)

I would like to see your improvements ✌


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