How to hide your program from the Ctrl+Alt+Del list
By: Massimo Branca Date: 11/02/2001

Note: because of security features of the OS, this may not work with Windows NT or 2000.

The Application Programming Interface makes it easy to hide your program from the task list. Simply use the handly code below to register your application as a service, thus rendering the program invisible to the user.

Here's How:

  1. Start up Visual Basic and add a form to the project.
    Copy this code into the declarations section of the form.

    Private Declare Function GetCurrentProcessId _
    Lib "kernel32" () As Long
    Private Declare Function GetCurrentProcess _
    Lib "kernel32" () As Long
    Private Declare Function RegisterServiceProcess _
    Lib "kernel32" (ByVal dwProcessID As Long, _
    ByVal dwType As Long) As Long
    Private Const RSP_SIMPLE_SERVICE = 1
    Private Const RSP_UNREGISTER_SERVICE = 0
  2. Create a new procedure to the form, called "MakeMeService" by adding the following code to the form.

    Function MakeMeService()
        Dim pid As Long
        Dim regserv As Long
        pid = GetCurrentProcessId()
        regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
    End Function
  3. To remove your program from the Ctrl+Alt+Delete add this code to call the procedure (i.e. in Form_Load).

    Call MakeMeService
  4. Create a new procedure to the form, called "UnMakeMeService" by adding the following code to the form.

    Function UnMakeMeService()
        Dim pid As Long
        Dim regserv As Long
        pid = GetCurrentProcessId()
        regserv = RegisterServiceProcess(pid, _
         RSP_UNREGISTER_SERVICE)
    End Function
  5. To unregister your application as a service (and therefore how the program in the Ctrl+Alt+Delete task list) add this code to call the procedure (i.e. in Form_Unload).

    Call UnMakeMeService

Webmaster - Thanks to Massimo Branca for posting this tip.

Click Here!


Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
To contact the Webmaster, click here.
Hosted by InWind: www.inwind.it