I created a sample on how to apply winlock in vb.net
Derived from: Dll and details
Form codes:
Module Codes:
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