How to activate the main window of an external UWP app (calc.exe)

Especially in my case, I want to activate an existing calculator window instead to start a new instance.

I assume calculator.exe is an UWP app and handling UWP apps is different to “normal windows” apps.

The calc.exe starts a process “calculator.exe”.
If calculator.exe process is found in process list, the main window should be activated (set keyboard focus and bring window to top).

The problem is, that the calculator.exe process has no main window. (process.MainWindowHandle = 0)
And the two thread windows I found (EnumThreadWindows) seems not to be activatable.

SetWindowPos with one of the thread windows seems not to have any effect.
SetWindowPos(hWnd, (IntPtr)(-1), 0, 0, 0, 0, ShowWindow|IgnoreMove|IgnoreResize)

SetForegroundWindow with one of the thread windows shows the calculator in foreground, but w/o keyboard focus.

So I am looking for ideas to solve the task. Thanks in advance.


MailHog SMTP Protocol For Golang

Financial Data Analysis with Python