From: umcruz@cc.umanitoba.ca (Darnell Cruz)
Subject: Re: Hiding from Task Manager
Date: 23 May 1995 13:24:42 GMT

If you use an enhaced task manager, you will find that there are programs 
which hide themselves from the task list.  The program runs, but you are 
unable to Alt-Tab to it nor switch to it in the task list.  There is an 
API call that is used to do this, and I've used it in a few of my Visual 
Basic programs.  It's called ShowWindow in the USER library.  The 
declaration for VB is as follows:

Declare Function ShowWindow Lib "User" (ByVal hWnd As Integer, ByVal 
nCmdShow As Integer) As Integer

The handle of the application to be hidden is also required, and you can 
either use a built-in function if avaiable or the API call FindWindow:

Declare Function ShowWindow Lib "User" (ByVal hWnd As Integer, ByVal 
nCmdShow As Integer) As Integer

A VB procedure to hide an app is as follows:

Sub hideme ()
'This hides this program so that it doesn't
'appear in the task list.  It thus prevents
'the user from setting focus on this program
'by using Alt-Tab or the Task Manager

    Dim Handle As Integer
    Dim WindowName As String

    WindowName = App.Title
    Const SW_Hide = 0

    Handle = FindWindow(0&, WindowName)
    X% = ShowWindow(Handle, SW_Hide)

End Sub


Hope this helps

Darnell

-- 
dEmI gOd                 | Never trust a skinny chef.
d_god@cc.umanitoba.ca    | 
Computer Engineering III | 
University of Manitoba   | Imagination is more important than knowledge.
