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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding application from NT Task Manager

Status
Not open for further replies.

darkman0101

Technical User
Oct 10, 2000
51
NZ
Does anyone know how to hide an exe created in VB6 from NT Task manager.

There is nothing sinister about this. I have an application that has a WaitForSingleObject call and in this wait state the application is deemed as Not Responding by Task Manager (applications tab).

This should be possible as other exe files appear in the Processes Tab but not in the Applications tab.

Cheers
Jason
 

The way to stop an application appearing in the Applications tab in the NT task manager is to hide the application's top-level, parent window.

Naturally, VB doesn't actually give you easy access to that window (it certainly isn't any of your forms). So here's a quick way of doing it (note, this example is for VB6 only)

Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_HIDE = 0

Private Sub HideApplication()
ShowWindow FindWindow("ThunderRT6Main", App.EXEName), SW_HIDE
End Sub
 
Sweet, Thanks for that.
The FindWindow function did not want to work for me with the value "ThunderRT6Main" as the class name though.
So I used call GetWindow(Me.hwnd, GW_OWNER) to obtain the owner of my Startup form and passes this into ShowWindow.

Cheers again,

Jason
 
Issue: it won't work properly in the development environment.

Don't have time to explain why.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top