by Randy Houck (6 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 7th August 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Kills the Windows Task Manager when it loads
API Declarations
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const SW_SHOWNORMAL = 1
Const WM_CLOSE = &H10
Timer1.Enabled = True
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Timer1.Enabled = False
End Sub
Private Sub Form_Resize()
Me.Hide
End Sub
Private Sub Timer1_Timer()
Dim WinWnd As Long, Ret As String, RetVal As Long, lpClassName As String
'Ask for a Window title
Ret = "Windows Task Manager" '= InputBox("Windows Task Manager:" + Chr$(13) + Chr$(10) + "Note: must be an exact match")
'Search the window
WinWnd = FindWindow(vbNullString, Ret)
If WinWnd = 0 Then
Exit Sub
End If
'close it...
PostMessage WinWnd, WM_CLOSE, 0&, 0&
End Sub