Asked by:
Hide from task manager's processes tab

Question
-
How do I prevent an application from appearing in the processes tab of the windows xp task manager??
I hv already tried many source codes from various locations, that probably used windows APIs for deleting the task prom the processes list veiw.
However, none of the codes seemed to have worked, mostly as the code was written using vb6 and my 2008 express edition shows errors while trying to upgrade them, pointingout certain language changes.
Knowing almost nothing about working with window's APIs, I am unable to update the code manually.
I just want to hide it from the process's tab of the "taskmgr.exe" application without disabling the task manager as a whole.
Plz help me out.
Thnks.
Wednesday, March 19, 2008 3:38 PM
All replies
-
hey there,
Once I had to do somenthig like this in my case I didn't hide the application from proccesses tab,I hided it from the taskbar then I renamed the application to a name that the user couldn't be able to close like svchost.exe or winlogon.exe.
To hide from the taskbar:me.showintaskbar=false
In my case it worked fine,I don't know if it'll apply to you
Wednesday, March 19, 2008 11:47 PM -
see i want to hide the application from my sister so that she does not terminate it!!
Now if i simply rename the file process to something like winlogon.exe, she would see the corresponding service as her user name, and she is clever enough to terminate it then!!
If only you could help me register that application as a network service or system process!!
Thanks a lot.
Thursday, March 20, 2008 5:51 AM -
hey,
I think of your case and I decided to teach u how to hide ur application.
first import the namespaces:
Imports System.Runtime.InteropServices
Imports System.Diagnostics
then declare the constants
Private Const SW_HIDE As Integer = 0
Private Const SW_RESTORE As Integer = 9
Private hWnd As Integer
then declare the win32 function
<DllImport("User32")> _
Private Shared Function ShowWindow(ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer
then you have to create a method to get the process name that u want to hide
Private p As Process() = Process.GetProcessesByName("the name of your process")
hWnd = CType(p(0).MainWindowHandle, Integer)
now u call the function
ShowWindow(hWnd, SW_HIDE)
Follow this and u'll hide your application of the processes .
note:If you rename your application to winlogon.exe even if your sister realized that the service is running with her user she won't be able to close it because the windows won't let cause winlogon.exe is a critical processes and can't be closed by the task manager.
Friday, March 21, 2008 5:53 PM -
I did the following:
Code SnippetImports
System.Runtime.InteropServicesImports
System.DiagnosticsPublic
Class Form1Private Const SW_HIDE As Integer = 0
Private Const SW_RESTORE As Integer = 9
Private hWnd As Integer
Private p As Process() = Process.GetProcessesByName("explorer.exe")
Declare Function ShowWindow Lib "User32" (ByVal hwnd As Integer, _ ByValnCmdShow As Integer) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Text = "Hide!!"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
hWnd = CType(p(0).MainWindowHandle, Integer)
'now u call the function
ShowWindow(hWnd, SW_HIDE)
End Sub
End Class
But when i click the button to hide the process it gives an IndexOutOfRange Exception for the call statement:
Code SnippethWnd = CType(p(0).MainWindowHandle, Integer)
What do i do??
Saturday, March 22, 2008 9:17 AM -
Don't consider all above!!!
I got all processes and looped to get the window handle of the required procress name!!
But there's still a problem!!
The command for hiding the procress does hide, but does not hide the process name, it Hides the corresponding window!!
I tried to hide vbexpress while debugging the application with this code and Lo!! Visual basic window disappeared!! The process name was still there!! I had to terminate and loose my application's contents!!
Plz help!!
Sunday, March 23, 2008 4:02 PM -
I hate to be a party pooper, but the task manager is all powerful. Not even a computer virus can hide from it. Plus its a huge security risk, should your application become unresponsive, you wont be able to do anything about it. Why exactly are you trying to hide it?Monday, March 24, 2008 3:29 AM
-
I have made an application that does a bit of my work no matter what user is logged on!!
Ending the nonresponsive application even if that does not show up in taskmanager is not challenging, U could do it by using CMD or make your own program.
All i want is to hide it from "Windows Task Manager", not from everywhere!!
Monday, March 24, 2008 11:27 AM -
Hi,
Try the following code snippet. It comes from here. You need to moidfy it to implement your requirement.
Code SnippetPublic Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Timer1 As System.Timers.Timer
Friend WithEvents ListView1 As System.Windows.Forms.ListView
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Timer1 = New System.Timers.Timer
Me.ListView1 = New System.Windows.Forms.ListView
CType(Me.Timer1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Timer1
'
Me.Timer1.Interval = 500
Me.Timer1.SynchronizingObject = Me
'
'ListView1
'
Me.ListView1.Location = New System.Drawing.Point(8, 8)
Me.ListView1.Name = "ListView1"
Me.ListView1.Size = New System.Drawing.Size(352, 464)
Me.ListView1.TabIndex = 0
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(400, 526)
Me.Controls.Add(Me.ListView1)
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
CType(Me.Timer1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Const WM_COMMAND As Int32 = &H111
Const MF_ENABLED As Int32 = &H0
Const MF_GRAYED As Int32 = &H1
Const LVM_FIRST As Int32 = &H1000
Const LVM_DELETEITEM As Int32 = (LVM_FIRST + 8)
Const LVM_SORTITEMS As Int32 = (LVM_FIRST + 48)
Public Declare Function apiFindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32
Public Declare Function apiFindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal lpsz1 As String, ByVal lpsz2 As String) As Int32
Public Declare Function apiEnableWindow Lib "user32" Alias "EnableWindow" (ByVal hwnd As Int32, ByVal fEnable As Int32) As Boolean
Public Declare Function apiGetMenu Lib "user32" Alias "GetMenu" (ByVal hwnd As Int32) As Int32
Public Declare Function apiGetSubMenu Lib "user32" Alias "GetSubMenu" (ByVal hMenu As Int32, ByVal nPos As Int32) As int32
Public Declare Function apiGetMenuState Lib "user32" Alias "GetMenuState" (ByVal hMenu As Int32, ByVal wID As Int32, ByVal wFlags As Int32) As Int32
Public Declare Function apiGetMenuItemID Lib "user32" Alias "GetMenuItemID" (ByVal hMenu As Int32, ByVal nPos As Int32) As Int32
Public Declare Function apiEnableMenuItem Lib "user32" Alias "EnableMenuItem" (ByVal hMenu As Int32, ByVal wIDEnableItem As Int32, ByVal wEnable As Int32) As Int32
Public Declare Function apiSendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As String) As Int32
Public Declare Function apiGetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Int32
Public Declare Function apiLockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Int32) As Int32
Dim i As Int32 'For iterating through task manager windows
Dim HiddenProcessName As String = "test" '"WindowsApplication1" 'Set this name to match the proces name of your application.
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MessageBox.Show(HiddenProcessName)
Me.Text = HiddenProcessName 'Set form name to match process name given
Me.ShowInTaskbar = False 'hide application from taskbar
Timer1.Interval = 700 'Set to start fast
Timer1.Enabled = True 'Actually start the timer
ListView1.View = View.Details
ListView1.Columns.Add("Process name", -2, HorizontalAlignment.Left)
ListView1.Sorting = SortOrder.Ascending 'So that the list view automatically sorts the entries for us.
'Me.Hide() 'uncomment when ready to terminate this program elsehow.
End Sub
Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
Dim lhWndParent As Int32 = apiFindWindow(Nothing, "Windows Task Manager") 'get handle to the task manager
'Declare some handles
Dim lhWndDialog As Int32 = 0
Dim lhWndEndTaskButton As Int32 = 0
Dim lhWndEndProcessButton As Int32 = 0
Dim lhWndProcessList As Int32 = 0
Dim lhWndProcessHeader As Int32 = 0
Dim lhWndTaskList As Int32 = 0
Dim lhWndTaskHeader As Int32 = 0
Dim ProcessItemCount As Int32 = 0
Dim ProcessItemIndex As Int32 = 0
Dim TaskItemCount As Int32 = 0
Dim TaskItemIndex As Int32 = 0
Dim hMenu As Int32 = apiGetMenu(lhWndParent) 'get it's menu handle
Dim hSubMenu As Int32 = apiGetSubMenu(hMenu, 2) 'get it's submenu handle for "View"
Dim hSubSubMenu As Int32 = apiGetSubMenu(hSubMenu, 1) 'get it's subsub menu handle for "update speed"
Dim hId1 As Int32 = apiGetMenuItemID(hSubMenu, 0) 'Get id for "refresh now" item
Dim hId2 As Int32 = apiGetMenuItemID(hSubSubMenu, 0) 'Get id for "high update speed" item
Dim hId3 As Int32 = apiGetMenuItemID(hSubSubMenu, 1) 'Get id for "normal update speed" item
Dim hId4 As Int32 = apiGetMenuItemID(hSubSubMenu, 2) 'Get id for "low update speed" item
Dim hId5 As Int32 = apiGetMenuItemID(hSubSubMenu, 3) 'Get id for "paused update speed" item
For i = 1 To 7
'Loop through all seven child windows, for handles to the listviews, buttons, and header
lhWndDialog = apiFindWindowEx(lhWndParent, lhWndDialog, Nothing, Nothing)
If lhWndTaskList = 0 Then lhWndTaskList = apiFindWindowEx(lhWndDialog, 0, "SysListView32", "Tasks")
If lhWndTaskHeader = 0 Then lhWndTaskHeader = apiFindWindowEx(lhWndTaskList, 0, "SysHeader32", Nothing)
If lhWndEndTaskButton = 0 Then lhWndEndTaskButton = apiFindWindowEx(lhWndDialog, lhWndTaskList, "Button", "&End Task")
If lhWndProcessList = 0 Then lhWndProcessList = apiFindWindowEx(lhWndDialog, 0, "SysListView32", "Processes")
If lhWndProcessHeader = 0 Then lhWndProcessHeader = apiFindWindowEx(lhWndProcessList, 0, "SysHeader32", Nothing)
If lhWndEndProcessButton = 0 Then lhWndEndProcessButton = apiFindWindowEx(lhWndDialog, lhWndProcessList, "Button", "&End Process")
Next
apiSendMessage(lhWndParent, WM_COMMAND, hId5, 0) 'Click "paused update speed", so we can do it for the taskmgr
apiEnableMenuItem(hMenu, hId1, MF_GRAYED) 'disable refresh now item
apiEnableMenuItem(hMenu, hId2, MF_GRAYED) 'disable high update speed
apiEnableMenuItem(hMenu, hId3, MF_GRAYED) 'disable normal update speed
apiEnableMenuItem(hMenu, hId4, MF_GRAYED) 'disable low update speed
apiEnableMenuItem(hMenu, hId5, MF_GRAYED) 'disable paused update speed
apiEnableWindow(lhWndProcessHeader, 0) 'Disable process header, so it cannot be resorted by user
apiEnableWindow(lhWndTaskHeader, 0) 'Disable task header. You could even disable the whole process list.
'apiEnableWindow(lhWndEndProcessButton, 0) 'Disable the end task,
'apiEnableWindow(lhWndEndTaskButton, 0)'and end process buttons. Optional.
Dim Processes() As Process
Dim p As Process
Dim z As Int32
Dim itemString As String
'clear any old data that was on the list
If Me.ListView1.Items.Count > 0 Then Me.ListView1.Items.Clear()
Processes = Process.GetProcesses() 'Get processes
'Count processes, and add them to the listview.
For Each p In Processes
ProcessItemCount += 1
If p.ProcessName.ToString = "Idle" Then
With Me.ListView1.Items.Add("System Idle Process")
End With
Else
With Me.ListView1.Items.Add(p.ProcessName.ToString)
End With
End If
Next p
'Look for, the index of the process matching the string name of our caption then
For z = 0 To ProcessItemCount - 1
itemString = ListView1.Items.Item(z).Text.ToString()
If itemString = HiddenProcessName Then ProcessItemIndex = z
Next
apiLockWindowUpdate(lhWndProcessList) 'Lock the window from updating, to reduce flashing.
apiSendMessage(lhWndParent, WM_COMMAND, hId1, 0) 'AutoClick refresh to update, then immediately sort and delete.
apiSendMessage(lhWndProcessList, LVM_SORTITEMS, 0, Nothing) ' Sort process items alphabetically
apiSendMessage(lhWndProcessList, LVM_DELETEITEM, ProcessItemIndex, 0) 'Delete the process,
apiLockWindowUpdate(False) 'unlock that window
If lhWndParent = 0 Then
If Timer1.Interval <> 800 Then Timer1.Interval = 800 'Set to react fast while task manager is closed.
Else
If Timer1.Interval <> 2500 Then Timer1.Interval = 2500 'Set to a normal looking update speed, while the task manager remains open.
End If
End Sub
Private Sub Form1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
Timer1.Enabled = False 'kill the timer
'reset task manager for normal use.
Dim lhWndParent As Int32 = apiFindWindow(Nothing, "Windows Task Manager") 'get handle to the task manager
Dim lhWndDialog As Int32 = 0
Dim lhWndEndTaskButton As Int32 = 0
Dim lhWndEndProcessButton As Int32 = 0
Dim lhWndProcessList As Int32 = 0
Dim lhWndProcessHeader As Int32 = 0
Dim lhWndTaskList As Int32 = 0
Dim lhWndTaskHeader As Int32 = 0
Dim hMenu As Int32 = apiGetMenu(lhWndParent) 'get it's menu handle
Dim hSubMenu As Int32 = apiGetSubMenu(hMenu, 2) 'get it's submenu handle for "View"
Dim hSubSubMenu As Int32 = apiGetSubMenu(hSubMenu, 1) 'get it;s subsub menu handle for "update speed"
Dim hId1 As Int32 = apiGetMenuItemID(hSubMenu, 0) 'Get id for "refresh now" item
Dim hId2 As Int32 = apiGetMenuItemID(hSubSubMenu, 0) 'Get id for "high update speed" item
Dim hId3 As Int32 = apiGetMenuItemID(hSubSubMenu, 1) 'Get id for "normal update speed" item
Dim hId4 As Int32 = apiGetMenuItemID(hSubSubMenu, 2) 'Get id for "low update speed" item
Dim hId5 As Int32 = apiGetMenuItemID(hSubSubMenu, 3) 'Get id for "paused update speed" item
For i = 1 To 7
'Loop through all seven child windows, for handles to the listviews, buttons, and header
lhWndDialog = apiFindWindowEx(lhWndParent, lhWndDialog, Nothing, Nothing)
If lhWndTaskList = 0 Then lhWndTaskList = apiFindWindowEx(lhWndDialog, 0, "SysListView32", "Tasks")
If lhWndTaskHeader = 0 Then lhWndTaskHeader = apiFindWindowEx(lhWndTaskList, 0, "SysHeader32", Nothing)
If lhWndProcessList = 0 Then lhWndProcessList = apiFindWindowEx(lhWndDialog, 0, "SysListView32", "Processes")
If lhWndProcessHeader = 0 Then lhWndProcessHeader = apiFindWindowEx(lhWndProcessList, 0, "SysHeader32", Nothing)
Next
apiEnableMenuItem(hMenu, hId1, MF_ENABLED) 're-enable refresh now
apiEnableMenuItem(hMenu, hId2, MF_ENABLED) 're-enable high update speed
apiEnableMenuItem(hMenu, hId3, MF_ENABLED) 're-enable normal update speed
apiEnableMenuItem(hMenu, hId4, MF_ENABLED) 're-enable low update speed
apiEnableMenuItem(hMenu, hId5, MF_ENABLED) 're-enable paused update speed
apiSendMessage(lhWndParent, WM_COMMAND, hId3, 0) 'click normal update speed
apiSendMessage(lhWndParent, WM_COMMAND, hId1, 0) 'click refresh now
apiEnableWindow(lhWndProcessHeader, 1) 'Enable process header
apiEnableWindow(lhWndTaskHeader, 1) 'Enable task header
End Sub
End Class
Best regards,
RiquelMonday, March 24, 2008 11:45 AMModerator -
Thnks 4 ur effort man!!
But I have already tried all this!!
Using the above code I could completly disable the task manager!! It disabled all the end process buttons and also the whole process list!!
The probblem is that my sister complained abt dat to my father and I got a nice scolding!!
The code given tries to hide a process:
Code SnippetapiSendMessage(lhWndProcessList, LVM_DELETEITEM, ProcessItemIndex, 0) 'Delete the process,but unfortunately dat does not work!!
Thnks a lot and plz help me hide the process name.
Monday, March 24, 2008 3:39 PM -
Hi all,, I have a program that I want to run many times over at same time. The program looks in task manager and if it is open it won't let you open it another time. Can anyone helpe me? Something that renames the task would most likely work. I do not have any experience in any coding.
So if anyone knows of a program that can help me please reply. thanks!
Thursday, March 27, 2008 4:58 AM -
Im assuming that you are not writing this program yourself. But If you want to run it as a second instance. You are going to have to run it as another user. To do this, right click the exe file that you want to run and select Run As... . Then you will need to select another user name such as "Administrator" and then type the password for the account you have chosen, if you dont know your administrative password then you may need to create another account and run it as that account. However, before you run software from it you might need to log in to the new account so that Windows creates the "My Documents" folder and other settings containers.
NOTE
Some applications are designed (Such as iTunes) not to allow more than 1 instance in the entire computer not just that account. An example of an application that does not do this is Danware Net Op.
I hope this helps you, I do NOT ENCOURAGE that you download a patch or any other illegal material to get around single instance applications. It is single instance for a reason and modifying it could hurt your computer.
Thursday, April 3, 2008 12:33 PM -
Hi!!
Maybe u could try unchecking the "single instance application" option in "project properties".
Saturday, April 26, 2008 7:44 AM -
It's not dat task manager is the ultimate!!
I hv got some code that does indeed hide frm task manager, but it also restricts api calls and so It becomes impossible to end the process using any process manager (even if u create ur own!!).
Moreover, even windows does not shut down!!
But i don't want such horror, and so I can't find some solution 4 my problem!!
Saturday, April 26, 2008 7:47 AM -
Windows service?
I'm not so sure on that though.
Saturday, April 26, 2008 8:52 AM -
I just read the first two post.. so maybe you guys figured it out already, but I don't think it is possible to hide from system processes. and asking such a question sounds like your making a virus.. haha. but I'm assuming if its on your computer, and your sister is using it, your probably making a monitoring program of some type, ex keylogger. Well I've made a keylogger, and the way I got around people closing it, is to make it so taskmgr cant be opened.. haha
For Each p As Process In Process.GetProcesses()
If p.ProcessName = "taskmgr" Then
p.Kill()
End If
NextTuesday, June 17, 2008 12:06 AM -
The problem with teaching him though is that other people will also see this post. Think of how much harm this information can do if the layfolk get their hands on it! You must destroy it!Tuesday, June 17, 2008 5:35 AM
-
okk... more than a year later.. i found the solution to ma problem... i learnt the usage of rootkits... LOLz...truely... its hard to find proper answers on this forum... but people here are just too much caring and helping... thnx to all for support and help.... :D
theres nothing better than prime nos...!!Friday, September 18, 2009 2:56 PM -
kool_pragy,
would you mind telling us more about your soltion you found? i know some are worried about this being used for maliscious purposes. but it can have it's good uses as well. i am interested in knowing about your solution.
thanks
FREE DEVELOPER TOOLS, CODE & PROJECTS at www.srsoft.us Database Code Generator and TutorialFriday, September 18, 2009 4:50 PM -
kool_pragy,
would you mind telling us more about your soltion you found? i know some are worried about this being used for maliscious purposes. but it can have it's good uses as well. i am interested in knowing about your solution.
thanks
FREE DEVELOPER TOOLS, CODE & PROJECTS at www.srsoft.us Database Code Generator and Tutorial
not for any malicious purpose...
i used a rootkit..
chk this out..
http://www.rootkit.com/
theres nothing better than prime nos...!!Thursday, October 15, 2009 7:30 AM -
kool_pragy,
would you mind telling us more about your soltion you found? i know some are worried about this being used for maliscious purposes. but it can have it's good uses as well. i am interested in knowing about your solution.
thanks
FREE DEVELOPER TOOLS, CODE & PROJECTS at www.srsoft.us Database Code Generator and Tutorial
not for any malicious purpose...
i used a rootkit..
chk this out..
http://www.rootkit.com/
theres nothing better than prime nos...!!
HI, can you please redirect on the exact link you get the solution from. I'm in need of the thing you found.- Proposed as answer by rajarshisinhababu Sunday, October 31, 2010 9:02 PM
Friday, July 9, 2010 11:50 PM -
yah its simple..
ur code need 2 check if taskmanger is runng. if yes then just kill it. just run a thread and put it in while(1). it will work file
array
<Process^> ^ pr_name=Process::GetProcessesByName("taskmgr");
for each(Process^ pr in pr_name){
//Console::WriteLine("hello");
pr->Kill();
}
rajarshisinhababuSunday, October 31, 2010 9:06 PM -
Please note that if you have really found a way to hide your process, you better check this using an external tool, which replaced the Task Manager. Try Process Explorer.
There is a difference between manipulating Windows Task Manager, than manipulating the list of processes in memory, which is used by all process enumeration tools.
Tuesday, January 8, 2013 8:36 PM