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

    • No support for Windows Hello!
    • I think you meant the "ntfs3" driver, but yes there have been a lot of fixes for it in this release and previous releases, not 100% sure if the issue you mentioned is fixed though. In any case, the new "ntfs" driver in 7.1 doesn't have that issue (at least, no reports of such have come thru), but your kernel needs to explicitly enable support for the new driver first (like how CachyOS kernel has it), and you need to edit your mount points in /etc/fstab to use "ntfs" instead of the other drivers.
    • Epic Games says Unreal Engine 6 will help developers "build content faster" using AI models by Pulasthi Ariyasinghe Epic Games is rolling out the latest major update to Unreal Engine 5 today, and at the same time, the company also dropped some information on the next-generation version of the product, Unreal Engine 6. This was already revealed a few weeks ago alongside the new Rocket League upgrade reveal. The company says it is combining the features of Unreal Engine and Unreal Editor for Fortnite to create this new version of its popular media creation tool. On top of creating entire games, the new engine will also focus on letting developers operate large-scale live service titles more easily, whether by shipping content into their own ecosystems or into Fortnite. The use of large language models is also mentioned here, with Epic saying it will be a core part of the engine. "We see LLMs, generative AI models, and tools like Claude and Codex playing a central role in helping you build content faster while maintaining the creative control you need," adds the company. Here is the rundown of what's new about version 6 of Unreal Engine: With all these changes to the programming model, portability upgrades, and generative AI integration, Epic says the new version of the engine will "change a lot about how games are made." The company aims to ship Unreal Engine 6 into early access in late 2027, with a full release planned for 12-18 months later. Epic Games also dropped a lengthy blog post about the new Unreal Engine 5.8 update for game developers over here. The release is focused on delivering better performance, customization, and streamlined workflows for development teams. This will be the final major update for this version of the engine before Epic switches to focus fully on Unreal Engine 6's early access launch.
    • Watch Louis Rossmann's recent experience on YouTube about trying to get a warranty replacement from Samsung. It's crazy.
    • That is the thing, how many of these people don't realise they are using AI? If they use Google Search they have no choice but to use AI. So yes, maybe half of American adults do use and I expect a lot of Uk adults do to, but I bet most of them don't realise it. Myself, i avoid the rubbish.
  • Recent Achievements

    • One Month Later
      Vincian earned a badge
      One Month Later
    • First Post
      Jocimo earned a badge
      First Post
    • Week One Done
      suprememobiles48 earned a badge
      Week One Done
    • One Month Later
      Windows Guy earned a badge
      One Month Later
    • One Month Later
      Prasann earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      500
    2. 2
      +Edouard
      162
    3. 3
      PsYcHoKiLLa
      86
    4. 4
      Steven P.
      68
    5. 5
      neufuse
      65
  • Tell a friend

    Love Neowin? Tell a friend!