You can block task manager by simply opening the file with no share access. This should stop CTRL + ALT + DELETE or opening of the program.
Simple example below let me know if works for you :)
'//
'// Class1.cls
'//
Option Explicit
'// executable name
Private Const TaskManager As String = "\taskmgr.exe"
Private Const BUFF_SIZE = 1024
Private Const INVALID_HANDLE_VALUE = (-1)
Private Const GENERIC_READ = &H80000000
Private Const OPEN_EXISTING = &H3
Private Declare Function CreateFileW Lib "kernel32" (ByVal lpFileName As Long, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function GetSystemDirectoryW Lib "kernel32" (ByVal lpBuffer As Long, ByVal uSize As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private m_Locked As Boolean
Private m_Location As String
Dim hFile As Long
Public Sub LockTaskManager(ByVal szLocation As String)
'// make sure not already locked.
If m_Locked <> True Then
hFile = CreateFileW(StrPtr(szLocation), GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0)
Else
Debug.Print "Already locked!"
End If
If hFile <> INVALID_HANDLE_VALUE Then
m_Locked = True
Else
m_Locked = False
End If
End Sub
Public Sub UnLockTaskManager()
If hFile <> INVALID_HANDLE_VALUE Then
CloseHandle hFile
hFile = INVALID_HANDLE_VALUE
m_Locked = False
End If
End Sub
Private Sub GetLocation()
Dim Buffer(BUFF_SIZE * 2) As Byte
Dim cb As Long
cb = GetSystemDirectoryW(VarPtr(Buffer(0)), BUFF_SIZE)
If cb <> 0 Then
m_Location = Left$(Buffer, cb) & TaskManager
Else
m_Location = vbNullString
End If
Erase Buffer
End Sub
Public Property Get Location() As String
Location = m_Location
End Property
Public Property Get Locked() As Boolean
Locked = m_Locked
End Property
Private Sub Class_Initialize()
'// taskmanager:::location
Call GetLocation
End Sub
Private Sub Class_Terminate()
'// force unlock in debug
UnLockTaskManager
End Sub
'//
'// Form1.frm
'//
Option Explicit
Dim tm As Class1
Private Sub Command1_Click()
'//lock taskmanager
tm.LockTaskManager tm.Location
End Sub
Private Sub Command2_Click()
'//unlock taskmanager
tm.UnLockTaskManager
End Sub
Private Sub Form_Load()
'//initalize
Set tm = New Class1
End Sub
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123:





by: SStoryPosted on 2009-11-03 at 09:44:36ID: 25731481
I had a code to hide the taskbar, but I don't know if it works in Vista, and a smart user will know keyboard shortcuts to go around that.
ShowCode.A sp?ID=187
Here is how to hide it:
http://www.freevbcode.com/