Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding UWP application from taskbar

Tags:

c#

winapi

I'm trying to hide UWP application from taskbar.

I found two way from this question for windows application but that's not works in UWP.

1.Delete WS_EX_TOOLWINDOW and add WS_EX_APPWINDOW to windows styles.

2.Delete it from taskbar with ITaskbarList::DeleteTab.

I Have problem with handler. The MainWindowHandle is empty! I know its because of the UWP, But how can I do it now?

Process[] p = Process.GetProcessesByName("Microsoft.StickyNotes");
IntPtr windowHandle = p[0].Handle;
var taskbarList = (ITaskbarList)new CoTaskbarList();
taskbarList.HrInit();
taskbarList.DeleteTab(windowHandle); //doesn't do anything
like image 226
Ali Akbar Azizi Avatar asked Nov 08 '22 06:11

Ali Akbar Azizi


1 Answers

Unfortunately, You can't hide it. Running in foreground app cannot be hidden from task bar. UWP doesn't support it at all yet.
But you can use background tasks. Here's an answer for a similar problem.

like image 116
XFox Avatar answered Nov 15 '22 07:11

XFox