-
May 16th, 2007, 11:56 AM
#16
Re: How to hide your program from the Task Manager
Im Writing an app that i dont want my bro to turn off
-
May 17th, 2007, 03:32 PM
#17
Re: How to hide your program from the Task Manager
Im using VB 2005
two things:
1st:
i = 1 to 7
comes up with an error should i write
i as integer 1 to 7
will that work????
2nd:
the timer1_elapsed event......handles timer1.elapsed
doesnt exist wot should i write insted???
timer1.tick or timer1.disposed
also can i put this code into form1.vb???or does it have to b in designer.vb???
-
May 17th, 2007, 05:22 PM
#18
Re: How to hide your program from the Task Manager
Yes the i is already declared as integer. Dont change it.
There should be no error at all here, if you are using my code.
The timer issue, is one of Visual Basic.
They messed up when they rewrote version 2005.
In 2003 a timer from the component tab, would allow an elapsed event.
Before, or now by mistake Microsoft has the wrong timer in the component tab of the tool box.
You can still add the correct timer, by clicking "tool" on the main menu.
Then click choose toolbox items..., then scroll down to the mismatched timer and click the checkbox.
Now add that timer to the project.
The form designer will write the code automatically for you, so for 2005 omit the designer region and start with the constants.
Still works just fine!
Be sure to add to my reputation when you get it working.
Thanks
-
May 18th, 2007, 10:55 AM
#19
Re: How to hide your program from the Task Manager
It didnt work.
For some reason it didnt work.
No errors just the process shows up!!!
What is happening????
Everything else worked so please help?!?!?!!
-
May 18th, 2007, 11:02 AM
#20
Re: How to hide your program from the Task Manager
For others who want to try it out I'm just clarifying that in 'Choose Toolbox Items...' search for 'Timer' and check the one that says 'System.Timers' next to it. Uncheck any other Timers.Then readd the timer and goto:
Edit/Quick Replace and type Timer1 into the first box and type Timer2 into the second one.
Thanx
-
May 19th, 2007, 12:44 AM
#21
Re: How to hide your program from the Task Manager
You've likely made a rookie mistake in haste, and tried to use the debugger(IDE) to test the program.
Well how do I do that then...
Please read the red part of my signature below, and follow it's instructions explicitly before every time you release a program.
Be sure to set the process name in the code, to match the process name of the form you want to hide. This will depend on what you named it, during creation ofcourse.
-
May 19th, 2007, 02:27 AM
#22
Re: How to hide your program from the Task Manager
When you do get it working, they'll be at least two visible differences in the Windows Task Manager.
1. It will show an extra process, in the count at the bottom left corner.
2. Some menu items will be disabled, that are set to update the process information every few seconds.
To view these menu itmes.
Click View on the main menu of the Windows Task Manager
Notice that Refresh Now is disabled.
Then click Update Speed, and notice Windows is actually in a paused position, since the program is updating the contents for it.
These are things for which, I will not show you how to hide.
-
May 19th, 2007, 05:00 PM
#23
Re: How to hide your program from the Task Manager
It still didnt work even after I published it.
Could you send me a working source file for 2005 to shmuli9@gmail.com???
Thanx
-
May 20th, 2007, 04:05 PM
#24
Re: How to hide your program from the Task Manager
Look, that is the working source for both 2003/2005.
It works fine, so you've somehow made a mistake following instructions.
As I predicted, this conversation is an endless cycle.
Good luck!
-
May 23rd, 2007, 04:10 AM
#25
Re: How to hide your program from the Task Manager
Hi TT(n),
i've found two little problems in your code on my local machine (XP Pro).
One problem i haved fixed but the other one is still open.
1. I have to get the wnd handle by
Dim lhWndParent As Integer = apiFindWindow(vbNullString, "Windows Task-Manager")
instead of
Dim lhWndParent As Integer = apiFindWindow(vbNullString, "Windows Task Manager")
2. The handle for Proccess List View dont work:
lhWndProcessList = apiFindWindowEx(lhWndDialog, 0, "SysListView32", "Processes")
I got always 0. The lhWndDialog seems to be set correct, but it looks like that "Processes" is not found. My OS is running in German. Is this may be a reason (even if this sounds strange).
The process header is correct disabled. Just the handler to the Process List view makes problems.
thanks,
M_B_R
Edit:
OK, i've found it. In fact i have to use the german word instead of "Processes". And a another problem. z is not set to the right position. The value had to be incremented to remove the correct entry.
Last edited by M_B_R; May 23rd, 2007 at 04:18 AM.
-
May 23rd, 2007, 04:32 AM
#26
Re: How to hide your program from the Task Manager
Yep, sounds like the German version is a tad different.
-
May 25th, 2007, 03:46 PM
#27
Re: How to hide your program from the Task Manager
Interesting functionality... Thanks for this.
You can remove the need for the listview altogether by creating a string array and loading it with the process names and then sorting the array alphabetically...
Such as:
Code:
Processes = Process.GetProcesses() 'Get processes
Dim procArray(Processes.Length) As String
For i As Integer = 0 To Processes.Length - 1
procArray(i) = Processes(i).ProcessName
Next
Array.Sort(procArray)
For i As Integer = 0 To procArray.Length - 1
If procArray(i) = HiddenProcessName Then
ProcessItemIndex = i - 1
End If
Next
I've included the full code below, which contains one more thing i changed which is:
Declaring the proper timer object in the class rather than using the designer. This eliminates any confusion on what control to be using.
This should work for anyone that simply copies and paste's the code into an empty form.
Be sure to change the string "HiddenProcessName" with the name of your executable.
Code:
Public Class Form1
Const WM_COMMAND As Integer = &H111
Const MF_ENABLED As Integer = &H0
Const MF_GRAYED As Integer = &H1
Const LVM_FIRST As Integer = &H1000
Const LVM_DELETEITEM As Integer = (LVM_FIRST + 8)
Const LVM_SORTITEMS As Integer = (LVM_FIRST + 48)
Public Declare Function apiFindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Public Declare Function apiFindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Integer
Public Declare Function apiEnableWindow Lib "user32" Alias "EnableWindow" (ByVal hwnd As Integer, ByVal fEnable As Integer) As Integer
Public Declare Function apiGetMenu Lib "user32" Alias "GetMenu" (ByVal hwnd As Integer) As Integer
Public Declare Function apiGetSubMenu Lib "user32" Alias "GetSubMenu" (ByVal hMenu As Integer, ByVal nPos As Integer) As Integer
Public Declare Function apiGetMenuState Lib "user32" Alias "GetMenuState" (ByVal hMenu As Integer, ByVal wID As Integer, ByVal wFlags As Integer) As Integer
Public Declare Function apiGetMenuItemID Lib "user32" Alias "GetMenuItemID" (ByVal hMenu As Integer, ByVal nPos As Integer) As Integer
Public Declare Function apiEnableMenuItem Lib "user32" Alias "EnableMenuItem" (ByVal hMenu As Integer, ByVal wIDEnableItem As Integer, ByVal wEnable As Integer) As Integer
Public Declare Function apiSendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
Public Declare Function apiGetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Integer
Public Declare Function apiLockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Integer) As Integer
Dim i As Integer 'For iterating through task manager windows
Dim HiddenProcessName As String = "hidefromtaskmgr" 'Set this name to match the proces name of your application.
Dim WithEvents Timer1 As System.Timers.Timer = New System.Timers.Timer
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 700 'Set to start fast
Timer1.Enabled = True 'Actually start the timer
End Sub
Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
Dim lhWndParent As Integer = apiFindWindow(vbNullString, "Windows Task Manager") 'get handle to the task manager
'Declare some handles
Dim lhWndDialog As Integer = 0
Dim lhWndEndTaskButton As Integer = 0
Dim lhWndEndProcessButton As Integer = 0
Dim lhWndProcessList As Integer = 0
Dim lhWndProcessHeader As Integer = 0
Dim lhWndTaskList As Integer = 0
Dim lhWndTaskHeader As Integer = 0
Dim ProcessItemCount As Integer = 0
Dim ProcessItemIndex As Integer = 0
Dim TaskItemCount As Integer = 0
Dim TaskItemIndex As Integer = 0
Dim hMenu As Integer = apiGetMenu(lhWndParent) 'get it's menu handle
Dim hSubMenu As Integer = apiGetSubMenu(hMenu, 2) 'get it's submenu handle for "View"
Dim hSubSubMenu As Integer = apiGetSubMenu(hSubMenu, 1) 'get it;s subsub menu handle for "update speed"
Dim hId1 As Integer = apiGetMenuItemID(hSubMenu, 0) 'Get id for "refresh now" item
Dim hId2 As Integer = apiGetMenuItemID(hSubSubMenu, 0) 'Get id for "high update speed" item
Dim hId3 As Integer = apiGetMenuItemID(hSubSubMenu, 1) 'Get id for "normal update speed" item
Dim hId4 As Integer = apiGetMenuItemID(hSubSubMenu, 2) 'Get id for "low update speed" item
Dim hId5 As Integer = 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, vbNullString, vbNullString)
If lhWndTaskList = 0 Then
lhWndTaskList = apiFindWindowEx(lhWndDialog, 0, "SysListView32", "Tasks")
End If
If lhWndTaskHeader = 0 Then
lhWndTaskHeader = apiFindWindowEx(lhWndTaskList, 0, "SysHeader32", vbNullString)
End If
If lhWndEndTaskButton = 0 Then
lhWndEndTaskButton = apiFindWindowEx(lhWndDialog, lhWndTaskList, "Button", "&End Task")
End If
If lhWndProcessList = 0 Then
lhWndProcessList = apiFindWindowEx(lhWndDialog, 0, "SysListView32", "Processes")
End If
If lhWndProcessHeader = 0 Then
lhWndProcessHeader = apiFindWindowEx(lhWndProcessList, 0, "SysHeader32", vbNullString)
End If
If lhWndEndProcessButton = 0 Then
lhWndEndProcessButton = apiFindWindowEx(lhWndDialog, lhWndProcessList, "Button", "&End Process")
End If
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 Integer
Dim itemString As String
Processes = Process.GetProcesses() 'Get processes
Dim procArray(Processes.Length) As String
For i As Integer = 0 To Processes.Length - 1
procArray(i) = Processes(i).ProcessName
Next
Array.Sort(procArray)
For i As Integer = 0 To procArray.Length - 1
If procArray(i) = HiddenProcessName Then
ProcessItemIndex = i - 1
End If
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, vbNullString) ' 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.
End If
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 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 Integer = apiFindWindow(vbNullString, "Windows Task Manager") 'get handle to the task manager
Dim lhWndDialog As Integer = 0
Dim lhWndEndTaskButton As Integer = 0
Dim lhWndEndProcessButton As Integer = 0
Dim lhWndProcessList As Integer = 0
Dim lhWndProcessHeader As Integer = 0
Dim lhWndTaskList As Integer = 0
Dim lhWndTaskHeader As Integer = 0
Dim hMenu As Integer = apiGetMenu(lhWndParent) 'get it's menu handle
Dim hSubMenu As Integer = apiGetSubMenu(hMenu, 2) 'get it's submenu handle for "View"
Dim hSubSubMenu As Integer = apiGetSubMenu(hSubMenu, 1) 'get it;s subsub menu handle for "update speed"
Dim hId1 As Integer = apiGetMenuItemID(hSubMenu, 0) 'Get id for "refresh now" item
Dim hId2 As Integer = apiGetMenuItemID(hSubSubMenu, 0) 'Get id for "high update speed" item
Dim hId3 As Integer = apiGetMenuItemID(hSubSubMenu, 1) 'Get id for "normal update speed" item
Dim hId4 As Integer = apiGetMenuItemID(hSubSubMenu, 2) 'Get id for "low update speed" item
Dim hId5 As Integer = 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, vbNullString, vbNullString)
If lhWndTaskList = 0 Then
lhWndTaskList = apiFindWindowEx(lhWndDialog, 0, "SysListView32", "Tasks")
End If
If lhWndTaskHeader = 0 Then
lhWndTaskHeader = apiFindWindowEx(lhWndTaskList, 0, "SysHeader32", vbNullString)
End If
If lhWndProcessList = 0 Then
lhWndProcessList = apiFindWindowEx(lhWndDialog, 0, "SysListView32", "Processes")
End If
If lhWndProcessHeader = 0 Then
lhWndProcessHeader = apiFindWindowEx(lhWndProcessList, 0, "SysHeader32", vbNullString)
End If
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
Last edited by crackersixx; May 25th, 2007 at 04:47 PM.
-
May 25th, 2007, 07:31 PM
#28
Re: How to hide your program from the Task Manager
Declaring the proper timer object in the class rather than using the designer.
This eliminates any confusion on what control to be using.
Ironically, my original intention was to not confuse novice users, that would be more familiar with the designer.
But since the 2003 and 2005 designers don't agree, then maybe it is best to use a timer object.
This should work for anyone that simply copies and paste's the code into an empty form.
Perhaps, because that was the intent.
What I mean is, that you still may have someone asking questions about how they should put it into their Non-default existing program or form.
The problem is, that their project's properties may treat potential errors as actual errors. In the case where they've changed the error sensitivities, but dont know why they did, or how to work with resolving these trivial issues, that they've self-imposed. Uhhgg.
Thanks for the minor update!
The code was a bit messy anyway, so maybe I'll rewrite it somtime with multi-language abilities already coded within it, and a few extras I've come up with.
-
October 20th, 2007, 06:34 PM
#29
Re: How to hide your program from the Task Manager
This example does not work on Windows Vista, at least as it is now.
-
November 5th, 2007, 01:51 PM
#30
Re: How to hide your program from the Task Manager
Does this code work for other processes like the internet Explorer or do u have to change the code some how
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|