Hide Program from Task Manager

ImDaFrEaK

Well-known member
Joined
Jan 7, 2006
Messages
416
Location
California
Programming Experience
5-10
Any ideas on how to hide a program from showing up in the task manager? I read about programs doing this but I thought Windows did not allow it. If it can be done can somone explain the process or give me an example please? Thanks :)
 
I don't know about hiding it completely but you can do a certain amount of hacking to stop it appearing. The problem with task manager is that it refreshes every 0.5 seconds, at a maximum, so the best way to do this would be with a timer. You will need the find window API call firing to determine when the task manager has been launched. Since we know what the window is called ("Windows Task Manager") it is a trivial matter to do that. Then you will need to navigate to the processes tab with FindWindowEx, or enumchildwindows. Then just use a SendMessage to that window in the following order.....

VB.NET:
Private Const LVM_DELETECOLUMN As Int32 = (LVM_FIRST + 28)

SendMessage(WindowHandle,LVM_DELETECOLUMN,0,0)
 
What do you mean 'Task Manager'? You can hide a program from Programs tab in Task Manager by setting the Form.ShowInTaskbar=False. Hiding it from the Processes tab in Task Manager would not be advicable, but can be done - I haven't tried the code but have seen vis781 example and at PSC a classic VB example that use Win32 APIs RegisterServiceProcess for Win9 systems and DeviceIoControl for WinNT systems.
 
Thanks guys. I looked at the code on the link you gave me JohnH and it looks like that would be a better route but it doesn't appear to be nearly as safe. I noticed many people were having problems with that code and this program I am writing can't crash or cause computer problems. It's not a virus or malware it's a security program, just to clear that up incase anyone thinks I am trying to code dirty.

vis781: I want to go with your example for now or at least give it a shot. Can you explain to me how that's actually working a little bit deeper. I am a little lost on the SendMessage() function. In the mean time I will look at Microsoft.com for some information on it. Inparticurly
VB.NET:
Private Const LVM_DELETECOLUMN As Int32 = (LVM_FIRST + 28)
'what does (LVM_FIRST + 28) represent?

Thanks to you both b/c it's all a great help :)
 
Last edited:
VB.NET:
Private Const LVM_FIRST As Int32 = &H1000

So basically, after you have found the window, you use the SendMessage API to 'tell' the TaskManager to remove the appropriate items. But as JohnH has said this is not advisable.
 
The LVM_... constants are a set of generic ListView constants all of which are LVM_FIRST + something. LMV_FIRST is not an index of the column but more an identifier to the message type. There is also LNV_... LV_... etc etc..
 
vis781, if you have the time to do me a small favor i would appreciate it tons. I am confused still as to how this is working. Can you, if it's not too tedious, build me a extremely simple app that just hides itself in the manner you suggested? If it's too hard then that's probably why I havn't got it yet, but I think I am just over looking the obvious here. Thanks again either way.
 
Back
Top