Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Source] Winlock in VB.NET
#1
I created a sample on how to apply winlock in vb.net

[Image: unledek.png]

Derived from: Dll and details
Code:
http://www.codeproject.com/KB/winsdk/AntonioWinLock.aspx

Form codes:
Code:
Public Class WinlockDemo

    'Show / Hide Desktop
    Private Sub CheckBox1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked = True Then
            'Hide desktop
            WinLock.Desktop_Show_Hide(False)
        Else
            'Show desktop
            WinLock.Desktop_Show_Hide(True)
        End If
    End Sub

    'Show / Hide Start Button
    Private Sub CheckBox2_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox2.CheckedChanged
        If CheckBox2.Checked = True Then
            'Hide Start Button
            WinLock.StartButton_Show_Hide(False)
        Else
            'Show Start Button
            WinLock.StartButton_Show_Hide(True)
        End If
    End Sub

    'Show / Hide Task Bar
    Private Sub CheckBox3_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox3.CheckedChanged
        If CheckBox3.Checked = True Then
            'Hide Task Bar
            WinLock.Taskbar_Show_Hide(False)
        Else
            'SHow Task Bar
            WinLock.Taskbar_Show_Hide(True)
        End If
    End Sub

    'Disable Alt Tab
    Private Sub CheckBox5_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox5.CheckedChanged
        If CheckBox5.Checked = True Then
            'Disable Alt+Tab. Switching
            WinLock.AltTab1_Enable_Disable(False)
            WinLock.AltTab2_Enable_Disable(0, False)
            WinLock.TaskSwitching_Enable_Disable(False)
        Else
            'ENable Alt+Tab. Switching
            WinLock.AltTab1_Enable_Disable(True)
            WinLock.AltTab2_Enable_Disable(0, True)
            WinLock.TaskSwitching_Enable_Disable(True)
        End If
    End Sub

    'Disable Task Manager, Ctrl+Alt+Del
    Private Sub CheckBox6_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox6.CheckedChanged
        If CheckBox6.Checked = True Then
            'Disable Task Manager
            WinLock.CtrlAltDel_Enable_Disable(False)
            WinLock.TaskManager_Enable_Disable(False)
        Else
            'Enable Task Manager
            WinLock.CtrlAltDel_Enable_Disable(True)
            WinLock.TaskManager_Enable_Disable(True)
        End If
    End Sub

    'Disable / Enable WinKeys
    Private Sub CheckBox7_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox7.CheckedChanged
        If CheckBox7.Checked = True Then
            'Disable WinKeys
            WinLock.Keys_Enable_Disable(False)
        Else
            'Enable WinKeys
            WinLock.Keys_Enable_Disable(True)
        End If
    End Sub

    ' Switch to a new desktop
    Private Sub CheckBox4_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox4.CheckedChanged
        If CheckBox4.Checked = True Then
            'Open Calculator in new desktop
            WinLock.Process_Desktop("str", "Calc.exe")
        End If
    End Sub

    'Show / Hide Clock
    Private Sub CheckBox8_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox8.CheckedChanged
        If CheckBox8.Checked = True Then
            'Hide Clock
            WinLock.Clock_Show_Hide(False)
        Else
            'SHow Clock
            WinLock.Clock_Show_Hide(True)
        End If
    End Sub

End Class

Module Codes:
Code:
Imports System.Runtime.InteropServices

Module WinLock

    <DllImport("WinLockDll.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Public Function AltTab1_Enable_Disable(ByVal bEnableDisable As Boolean) As Integer
    End Function

    <DllImport("WinLockDll.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Public Function AltTab2_Enable_Disable(ByVal hWnd As Long, ByVal bEnableDisable As Boolean) As Integer
    End Function

    <DllImport("WinLockDll.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Public Function Clock_Show_Hide(ByVal bShowHide As Boolean) As Integer
    End Function

    <DllImport("WinLockDll.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Public Function CtrlAltDel_Enable_Disable(ByVal bEnableDisable As Boolean) As Integer
    End Function

    <DllImport("WinLockDll.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Public Function Desktop_Show_Hide(ByVal bShowHide As Boolean) As Integer
    End Function

    <DllImport("WinLockDll.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Public Function Keys_Enable_Disable(ByVal bEnableDisable As Boolean) As Integer
    End Function

    <DllImport("WinLockDll.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Public Function Process_Desktop(<MarshalAs(UnmanagedType.VBByRefStr)> ByRef szDesktopName As String, _
                                           <MarshalAs(UnmanagedType.VBByRefStr)> ByRef szPath As String) As Integer
    End Function

    <DllImport("WinLockDll.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Public Function StartButton_Show_Hide(ByVal bShowHide As Boolean) As Integer
    End Function

    <DllImport("WinLockDll.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Public Function Taskbar_Show_Hide(ByVal bShowHide As Boolean) As Integer
    End Function

    <DllImport("WinLockDll.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Public Function TaskManager_Enable_Disable(ByVal bEnableDisable As Boolean) As Integer
    End Function

    <DllImport("WinLockDll.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Public Function TaskSwitching_Enable_Disable(ByVal bEnableDisable As Boolean) As Integer
    End Function

End Module
USB Anti-virus? Try USB Drive Defender
[Image: 8bQCusS.jpg]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Free Advanced Port Scanner SOURCE [ VB.NET ] Filefinder 6 5,747 01-22-2013, 04:27 AM
Last Post: TalishHF
  [VB.NET]Console app Menu example (amortization calculator)[Source] KoBE 8 8,168 12-28-2012, 06:55 AM
Last Post: mouse719
  [VB.NET] Get Region Info [Source] ƃu∀ ıʞƃu∀ 0 1,252 11-28-2012, 04:38 AM
Last Post: ƃu∀ ıʞƃu∀
  How To Make And Use A Builder And Stub. [VB.NET] [Source] Vorfin 35 23,245 11-25-2012, 10:34 PM
Last Post: ƃu∀ ıʞƃu∀
  [Source] Tricks Using PictureBox Control [VB.NET] Fragma 8 6,496 11-25-2012, 10:32 PM
Last Post: ƃu∀ ıʞƃu∀

Forum Jump:


Users browsing this thread: 1 Guest(s)