utility that can hide a taskbar button, but leave the window as-is?


Recommended Posts

I run a to-do list app all the time, just leave it open in the background. Is there any way to hide the button in the taskbar, but leave the program's window open?

I've found a couple freebie utilities that can move the button to the tray, but they also minimize the window.

Anyone know of such a thing?

A taskbar button is directly linked to the window. The window needs to specify the property not to have a taskbar button to hide it, and I don't believe the WinAPI has a function to force this or do it for a window not owned by your thread.

A taskbar button is directly linked to the window. The window needs to specify the property not to have a taskbar button to hide it, and I don't believe the WinAPI has a function to force this or do it for a window not owned by your thread.

Thanks.

This code might be of some help. What it does is sets the window style of a given application to a tool window instead of an app window. The point of this is that windows with the param "WS_EX_TOOLWINDOW" are made to be hidden from the task bar. The problem is that this code doesn't work unless you can execute it on form activation (or initialization of the target window).

I'm not sure if there is another way to hide it or if you'd have to somehow inject/subclass the processes initialization process.

Winapi functions and defined constants for C#:

 [DllImport("user32.dll")]
		static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

 [DllImport("user32.dll")]
		private static extern int GetWindowLong(IntPtr hWnd, int nIndex);

		private const int GWL_EXSTYLE = (-20);
		private const int WS_EX_TOOLWINDOW = 0x80;
		private const int WS_EX_APPWINDOW = 0x40000;

Function to detect process and set information:

 Process[] processes = Process.GetProcessesByName("yourProcessHere");

			foreach (Process p in processes)
			{

				IntPtr pWindow = p.MainWindowHandle;

				SetWindowLong(pWindow, GWL_EXSTYLE, (GetWindowLong(pWindow,
GWL_EXSTYLE) | WS_EX_TOOLWINDOW) & ~WS_EX_APPWINDOW);

			}

I'll see if I can dig anything else up.

Edit: According to this (http://vcfaq.mvps.org/mfc/4.htm) it may be possible to hide the button from the taskbar by the following:

The best method is to make the application's top level window have a parent window that is invisible.

So it may be possible with some code to create a parent window for that app that is invisible. I've never done that before so I'd have to look into it.

Edit #2: Tested it out and I was able to create a MDI form in C# and use the following API:

		[DllImport("user32.dll")]
		private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

I was able to set the parent window for notepad to the app I made and effectively remove the button from the task bar. There is another problem though -- I can't figure out how to make the parent window invisible/transparent without making the child window(s) invisible as well. If either problem could be solved then it'd be fairly easy to make an app for you that would do as you want.

Edited by dlegend

an out of the box solution would be to find and use a widget that's a to do list. cause widgets don't spear in your task bar and as long as you have only a few of them they won't take up that much ram. if you have vista it's already there of course and i am sure you can google it to find an easy solution for xp.

I just came up with a neat programming solution (in C#) to address this problem. It utilizes both methods I mentioned above and works flawlessly (with the exception of a quick flicker of the window). To do this you'll first need to create a MDI form and then use the following:

Namespaces

using System.Runtime.InteropServices;
using System.Diagnostics;

DLL Function Imports

		[DllImport("user32.dll")]
		static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

		[DllImport("user32.dll")]
		private static extern int GetWindowLong(IntPtr hWnd, int nIndex);

		[DllImport("user32.dll")]
		private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

Constants

		private const int GWL_EXSTYLE = (-20);
		private const int WS_EX_TOOLWINDOW = 0x80;
		private const int WS_EX_APPWINDOW = 0x40000;

Main Function

Process[] processes = Process.GetProcessesByName("processNameHere");

			foreach (Process p in processes)
			{
				IntPtr pWindow = p.MainWindowHandle; 

				int iWindowStyle = GetWindowLong(pWindow, GWL_EXSTYLE); 

				SetParent(pWindow, this.Handle);
				SetWindowLong(pWindow, GWL_EXSTYLE, (iWindowStyle | WS_EX_TOOLWINDOW) & ~WS_EX_APPWINDOW);
				SetParent(pWindow, (IntPtr)0);
				SetWindowLong(pWindow, GWL_EXSTYLE, iWindowStyle);
			}

What the main function does is find the process's main window, gets the extended window style, makes the window a child of our app, sets the extended window style to become a tool window, sets child windows parent back to the desktop, and reapplies its original extended window style back.

As described earlier, just setting the extended window style itself wasn't enough -- it was only able to work correctly upon initialization of the window. By creating a parent window and setting the extended window style and by then setting the parent window back to the desktop, it updates the extended window style without having to be done through form/window initialization.

Now if you could link me to the to-do list app your having problems with, I can probably customize the code to work specifically for it.

an out of the box solution would be to find and use a widget that's a to do list. cause widgets don't spear in your task bar and as long as you have only a few of them they won't take up that much ram. if you have vista it's already there of course and i am sure you can google it to find an easy solution for xp.

Yes the app I've used in the past is called Post It Digital Notes, and by design it doesn't create a taskbar button. But it's very limited connectivity wise and that's why I started using this new one.

I just came up with a neat programming solution (in C#) to address this problem. It utilizes both methods I mentioned above and works flawlessly (with the exception of a quick flicker of the window). To do this you'll first need to create a MDI form and then use the following:

Namespaces

using System.Runtime.InteropServices;
using System.Diagnostics;

DLL Function Imports

		[DllImport("user32.dll")]
		static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

		[DllImport("user32.dll")]
		private static extern int GetWindowLong(IntPtr hWnd, int nIndex);

		[DllImport("user32.dll")]
		private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

Constants

		private const int GWL_EXSTYLE = (-20);
		private const int WS_EX_TOOLWINDOW = 0x80;
		private const int WS_EX_APPWINDOW = 0x40000;

Main Function

Process[] processes = Process.GetProcessesByName("processNameHere");

			foreach (Process p in processes)
			{
				IntPtr pWindow = p.MainWindowHandle; 

				int iWindowStyle = GetWindowLong(pWindow, GWL_EXSTYLE); 

				SetParent(pWindow, this.Handle);
				SetWindowLong(pWindow, GWL_EXSTYLE, (iWindowStyle | WS_EX_TOOLWINDOW) & ~WS_EX_APPWINDOW);
				SetParent(pWindow, (IntPtr)0);
				SetWindowLong(pWindow, GWL_EXSTYLE, iWindowStyle);
			}

What the main function does is find the process's main window, gets the extended window style, makes the window a child of our app, sets the extended window style to become a tool window, sets child windows parent back to the desktop, and reapplies its original extended window style back.

As described earlier, just setting the extended window style itself wasn't enough -- it was only able to work correctly upon initialization of the window. By creating a parent window and setting the extended window style and by then setting the parent window back to the desktop, it updates the extended window style without having to be done through form/window initialization.

Now if you could link me to the to-do list app your having problems with, I can probably customize the code to work specifically for it.

The application is called Evernote, the free version (www.evernote.com). I really don't want to put you out in custom-creating this, though I'd certainly be grateful if you do--there's no way I can make an "MDI form" and make use of the code you've provided.

Have you tried Tray It? Install and run Tray It, then right click the app and select "Place in system tray", then double click it/right click and select Edit Profile. In the Tray It Minimizing Option dialog, go to More tab, Hide application from the taskbar all the time, only keep tray icon. Then use Windows's built in notification area settings to hide the tray icon.

Have you tried Tray It? Install and run Tray It, then right click the app and select "Place in system tray", then double click it/right click and select Edit Profile. In the Tray It Minimizing Option dialog, go to More tab, Hide application from the taskbar all the time, only keep tray icon. Then use Windows's built in notification area settings to hide the tray icon.

That is exactly what I'd been looking for. Tested it and it works great. Thanks much!

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Well i'll look into a docking station if needed and use that.    Normally i don't usually have all the drives connected at once,  usually once a month to sync the latest files, and then they go back in there storage area   
    • memories! completely forgot about alcohol 120%!!!! man this list just makes me think of all the exciting times! everything's become so sterilized these days. 
    • Salesforce to acquire Fin, formerly Intercom, for over $3 billion by David Uzondu Image via DepositPhotos.com Salesforce today announced that it has reached an agreement with customer support software company Fin to buy the company for around $3.6 billion. Salesforce expects the transaction to close in the fourth quarter of its fiscal year 2027, and the acquisition will not change its financial guidance previously announced on May 27. Marc Benioff, CEO of Salesforce, in its press release, claimed that acquiring the startup gives Salesforce an immediate AI agent that resolves support tickets across email, WhatsApp, SMS, and Slack: You might know Fin by its former name, Intercom. If you have ever been on a website or inside a mobile app and noticed a little chat bubble widget floating in the bottom right corner of your screen, often featuring a friendly face and a message like, "Hi! How can we help you today?" you were almost certainly looking at Intercom. Intercom became Fin just last month, transforming itself into an "AI-first" platform that handles customer issues with little need for humans to intervene. The new name originates from the company's highly successful AI customer service agent, which it launched way back in 2023. This digital assistant supposedly resolves about 76% of customer service volume end-to-end on its own, so the business rebranded to match its primary software tool. Fin's new owners, Salesforce, went on an acquisition spree over the last few years, and some of them you might recognize, like its 2020 $27.7 Billion acquisition of Slack. The last few months saw the enterprise giant buy several startups, including m3ter, Momentum, Cimulate, and Contentful. Salesforce said that when the Fin deal pulls through, customers will "deploy AI agents across" various service operations, which will complement Agentforce, the platform that enables businesses to deploy customizable autonomous digital workers.
  • Recent Achievements

    • One Year In
      ThatGuyOnline earned a badge
      One Year In
    • Week One Done
      Jeroen Wilms earned a badge
      Week One Done
    • Week One Done
      rolfus earned a badge
      Week One Done
    • One Month Later
      Leroy Jethro Gibbs earned a badge
      One Month Later
    • Conversation Starter
      flexorcist earned a badge
      Conversation Starter
  • Popular Contributors

    1. 1
      +primortal
      508
    2. 2
      +Edouard
      201
    3. 3
      PsYcHoKiLLa
      127
    4. 4
      Steven P.
      82
    5. 5
      ATLien_0
      76
  • Tell a friend

    Love Neowin? Tell a friend!