c# remove 3rd party application from taskbar

c#, hide, taskbar, winapi, windows

Solution

If you have the handle to the window you can call `ShowWindow()` through the Win32 API. Then you can do:

// Let the window disappear (even from taskbar)
ShowWindow(this.Handle, WindowShowStyle.Hide);

// Revive the window back to the user
ShowWindow(this.Handle, WindowShowStyle.ShowNoActivate);

So from now, all your problem is to get the handle of the window you like to hide:

Process[] procs = Process.GetProcesses();
IntPtr hWnd;
foreach(Process proc in procs)
{
   if ((hWnd = proc.MainWindowHandle) != IntPtr.Zero)
   {
      Console.WriteLine("{0} : {1}", proc.ProcessName, hWnd);
   }
}

Problem

How to remove an 3rd party application from the Windows taskbar by its handle? I've found this: Remove application from taskbar with C# wrapper? But it doesnt worked for me. It only sets another style (small x to close, no maximize/minimize button) to the Window i selected (notepad). Any ideas about this? EDIT: I dont want to remove MY application from the taskbar, i want to remove an external application by handle

Original source

Related problems