5

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

cyptus
  • 3,346
  • 3
  • 31
  • 52
  • possible duplicate of [Win32: How to hide 3rd party windows in taskbar by hWnd](http://stackoverflow.com/questions/7219063/win32-how-to-hide-3rd-party-windows-in-taskbar-by-hwnd) – Oliver May 10 '12 at 07:52

4 Answers4

4

To hide it from windows task bar you just need to set ShowInTaskbar property to false :

this.ShowInTaskbar = false;

As for moving of windows you can use spy++ to check windows events and identify it.

Zaki
  • 5,540
  • 7
  • 54
  • 91
4

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);
   }
}
Oliver
  • 43,366
  • 8
  • 94
  • 151
  • 1
    this doesnt worked for me. after hiding the windows they are invisible, after setting shownoactivate they are visible again but also shown in the taskbar. – cyptus May 09 '12 at 15:08
  • @user1216595: Ok, i misunderstood you. You want to see the window, but it should not appear within the taskbar. I thought you would like to hide the window (like minimize) AND remove it from the taskbar. – Oliver May 10 '12 at 07:47
  • 1
    @user1216595: In that case [this question has already been answered](http://stackoverflow.com/questions/7219063/win32-how-to-hide-3rd-party-windows-in-taskbar-by-hwnd). – Oliver May 10 '12 at 07:51
  • this aint restore : IntPtr hWnd = p[0].MainWindowHandle; ShowWindow(hWnd, WindowShowStyle.ShowNoActivate); – Furkan Gözükara Aug 01 '16 at 15:19
0

How to remove an application from the Windows taskbar?

this.ShowInTaskbar = false;
-3

Easy:

this.ShowInTaskbar = false;

As for the Form movement: you can use the Move event under Layout events

Shai
  • 25,159
  • 9
  • 44
  • 67