API Programming Series #4

The concept

Here the key concept to be understood is this:

The task list, while showing the currently running "tasks" on a machine, does not display those registered as services. So to prevent a task from appearing in the task list, we just need to register it as a service. And to make the task appear in the task list again, unregister it. Simple!

Let's get on with the code.

As always, start up Visual Basic and create a new Standard EXE project. A form should have been added to the project by default. Copy the following 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

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The greatest performance improvement of all is when a system goes from not-working to working.” - John Ousterhout