如何從Windows任務欄中刪除第三方應用程序?c#從任務欄中刪除應用程序
我發現這一點: Remove application from taskbar with C# wrapper?
但它不爲我工作。 它只設置了另一種風格(小x關閉,沒有最大化/最小化按鈕)到我選擇的窗口(記事本)。
對此的任何想法?
編輯:我不想從任務欄中刪除我的應用程序,我想要刪除外部應用程序。
如何從Windows任務欄中刪除第三方應用程序?c#從任務欄中刪除應用程序
我發現這一點: Remove application from taskbar with C# wrapper?
但它不爲我工作。 它只設置了另一種風格(小x關閉,沒有最大化/最小化按鈕)到我選擇的窗口(記事本)。
對此的任何想法?
編輯:我不想從任務欄中刪除我的應用程序,我想要刪除外部應用程序。
如果你有窗口的句柄,你可以通過Win32 API調用ShowWindow()
。然後,你可以這樣做:
// Let the window disappear (even from taskbar)
ShowWindow(this.Handle, WindowShowStyle.Hide);
// Revive the window back to the user
ShowWindow(this.Handle, WindowShowStyle.ShowNoActivate);
所以從現在開始,所有的問題是讓你想隱藏窗口的句柄:
Process[] procs = Process.GetProcesses();
IntPtr hWnd;
foreach(Process proc in procs)
{
if ((hWnd = proc.MainWindowHandle) != IntPtr.Zero)
{
Console.WriteLine("{0} : {1}", proc.ProcessName, hWnd);
}
}
的[Win32的
可能重複:如何隱藏第三方窗口在任務欄由hWnd](http://stackoverflow.com/questions/7219063/win32-how-to-hide-3rd-party-windows-in-taskbar-by-hwnd) – Oliver