Hide Application From Appearing Both On And Above XP Locked Taskbar

I have created a Delphi 5 SDI application which I am running on Windows XP. I would like to know what steps I need to take to prevent this application from ever appearing on (or above) the XP Taskbar. I do want the application to continue to appear in the ALT-TAB list and in the process list. It is just the TaskBar and the area above it that I am asking about.

My XP Taskbar's appearance is configured as follows:
Lock The TaskBar - Checked
Auto Hide the Taskbar - UNchecked
Keep the Taskbar on top of other windows - Checked
Group similar taskbar buttons - Checked
Show quick launch - Checked

I have found several answers to this specific question on Expert Exchange (typically utilizing SetWindowLong) and have tried implementing them to some degree of success. Where I am getting stuck is when I minimize my application's main form. While the app no longer appears in the TaskBar, it does insist on appearing as a small icon immediately above the TaskBar on the left hand side. I would like to be able to minimize the app and have it not appear in either place.


Who is Participating?

Improve company productivity with a Business Account.Sign Up

vadim_tiConnect With a Mentor Commented:
I think you can use this code in main form OnCreate event:

  ShowWindow(Application.Handle, SW_HIDE);
  SetWindowLong(Application.Handle, GWL_EXSTYLE,
    GetWindowLong(Application.Handle, GWL_EXSTYLE)
  ShowWindow(Application.Handle, SW_SHOW);
Wim ten BrinkSelf-employed developerCommented:
Do it simple... Turn your application into a system service. Works fine on XP. Just make sure it is set up to be interactive with the desktop or else you'd never se any of it's forms...
php4delphiConnect With a Mentor Commented:
Add Application.OnMinimize event handler with the following code

ShowWindow(Application.Handle, SW_HIDE);

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

ilmds123Author Commented:

I tried your suggestion and while it does remove the item from the TaskBar when the app is minimized, it also removes it from the ALT-TAB list. Is there a way to have it just be removed from the TaskBar only? I would like it to remain on the ALT-TAB list. In addition I would like it to always be removed from the TaskBar regardless of whether the app is minimized or not.

ilmds123Author Commented:

Thank you for your response. I've never created a system service application and have just looked at some of the Delphi 5 Help documentation about "Service Applications". Is this the same thing? If so, at initial glance and not knowing all my options (which I realize may be few to none) your suggestion seems like this would require a considerable amount of effort to achieve what would seem to me like something so simple to do - the removal of an item from the XP TaskBar. Again bear in mind that I have never attempted a Service App and don't know what is involved.

1. How often are service apps used as standard types of end user apps (non multi user, non networked, simple data entry apps) which is what my app would be considered?

2. Could you tell me a little more about what would be involved in converting an existing application to a service application?

3. Also is there no other simpler way to a accomplish what I am trying to do?

Wim ten BrinkConnect With a Mentor Self-employed developerCommented:
Yep. The service application. And indeed, it means that you will have a lot of new things to learn. Knowing more about system services is a good thing but if time is a limitation then you need a simpler solution. Still, system services aren't that complicated, once you're familiar with them. The biggest advantage is that they just keep running in the background like TSR applications in the MS-DOS era.

1) Services are, in general, background applications. Often meant to do some important background calculations or communications with hardware and network. But it's also used for e.g. schedulers that just need to wait until a certain thime, then triggers some action. Or for databases like SQL Server or InterBase, where the service is running in the background, to speed up communications between the database on disk and any application trying to connect to it. With SQL Server, for example, you have a separate application that hides as trayicon that communicates with the SQL database service and allows a user interface for the user to configure it. But even if that application is closed, the service keeps running.

2) To convert to a system service, you first have to check if you can separate the business logic from the user interface. The service can still interact with the user though it's GUI, though. Also, when working with services, it helps if you're familiar with multi-threaded programming. It's not required but it helps. There's an important difference with normal applications since it's not a normal application. The TApplication object differs from the normal one. But you can create a form, show it, hide it, close it and release it again, if you want.

3) SetWindowLong is one of the alternatives. But is there a trayicon component in your project?
ilmds123Author Commented:

Thanks for responding. I used your suggestion and it does indeed remove the app from the taskbar and leaves it in the ALT-TAB list as I need but I still have one problem. As I stated in my original question, while the app no longer appears in the TaskBar, it does insist on appearing as a small icon immediately above the TaskBar on the left hand side when minimized. Do you know of a way to keep the small icon from appearing when minimized?

The problem is that you can switch using ALT-TAB only between visible windows. As soon as you hide all windows of your application is not possible to use ALT-TAB anymore. The solution can be to use OnMinimize event to move minimized form out of screen, for example at point -10000, -10000 and restore form position in OnRestore event.
ilmds123Author Commented:
Thanks to everyone for your help.  I accepted vadim_ti's answer for its succinctness and split with php4delphi for the assist as well as workshop_alex for providing an interesting alternative. To answer your question workshop_alex, my app does not currently use a trayicon. When given the time I'll look into system services in the future and will go with vadim_ti's for the present.

Thanks again everyone.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.