Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Task Manager

Status
Not open for further replies.

Bubbler

IS-IT--Management
Dec 14, 2003
135
US
I know it can't be done, however I have located a work around and I am seeking input from other developers as to thoughts (possible crashes, tangles etc)

This seems to be a viable solution if your goal is only to prevent the user from using task manager. If you put this in a timer with a Interval of 1 then the instant task mangager comes up an alt f4 is sent closing it.

On Error GoTo exitsub
AppActivate "Windows Task Manager"
thesendkeys = "%{F4}"
SendKeys (thesendkeys)
Exit Sub
exitsub:
Exit Sub



the othe soluton I found was:

'Place the following code in a module

Option Explicit

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Public Const WM_CLOSE = &H10

'THIS WILL CLOSE AN APP BY CAPTION ONLY

Public Sub CloseProgram(ByVal Caption As String)
On Error GoTo EVT
Dim lngWin As Long
lngWin = FindWindow(vbNullString, Caption)
If lngWin = 0 Then Exit Sub
SendMessage lngWin, WM_CLOSE, 0&, 0&

Exit Sub
EVT:
Err.Clear
Resume Next
End Sub

Call the code above by Call CloseProgram("My Applications Caption")

Please note that the code above will terminate without notice if an error occurs.

So, Input? houghts? Experiences?


 
For those who are wondering why you can't disable Ctrl-Alt-Del on NT, 2000, XP, 2003, please read faq222-3809.

Bubbler -
I've requested that your title be changed to "Disable TaskManager", as that's more reflective of what you're asking for comments on.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top