Search Tools Links Login

Kill WinXP Task Manager


Visual Basic 6, or VB Classic

After searching and searching PSC I decided I would put together a little something to help WinXP users and that Task Manager issue. This code runs every 10 milliseconds. (to my knowledge there is no side effects to running this timer every 10 milliseconds.) This timer will actually find and close the Windows Task Manager if it becomes active. Any Feedback would be nice. This is my first code submission.

Original Author: 1

Side Effects

*COULD* Be a hit on resources due to the fact that its running code in a timer routine every 10 milliseconds. Although I did not encounter any.

Code

'Simply put this goes at the top of your new form.
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) 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
Private Const WM_CLOSE = &H10
Dim winHwnd As Long, RetVal As Long
'declares(experienced coders will know more about these.)
'Then simply make a timer or copy this code and create a timer with the same name on your application.
Private Sub TestTask_Timer()
winHwnd = FindWindow(vbNullString, "Windows Task Manager") 'Simply put it makes sure that task manager has been opened.
If winHwnd <> 0 Then
  PostMessage winHwnd, WM_CLOSE, 0&, 0&
Else
  'Doesn't Exit? Then
  'Do Nothing, Technically this is a loop I created with a timer.
End If
frmMain.SetFocus
End Sub
'then run your app and hit "CTRL-ALT-DELETE" if everything is running correctly you shouldn't even have time to focus on the manager it will have closed to quickly.

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 106 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.