microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.78k stars 319 forks source link

Implement Launcher::LaunchUriForResultsAsync for desktop apps #1938

Open JaiganeshKumaran opened 2 years ago

JaiganeshKumaran commented 2 years ago

Related to #1034, #1157.

In UWP apps, you can use Launcher::LaunchUriForResultsAsync to launch another app through protocol activation and make its UI show up in a modal dialog relative to the current CoreWindow. However, it can't be used with Desktop apps (other Launcher methods seem to work just fine).

saul-mtz commented 2 years ago

It works for Win32 apps too, as CoreWindow is only for UWP apps you must use the IInitializeWithWindow interface, see https://devblogs.microsoft.com/oldnewthing/20190412-00/?p=102413

jonwis commented 5 months ago

I'm trying this myself right now. Yes, you need to IInitializeWithWindow trick. My sample is packaged Win32 WinUI3 -> packaged Win32 WinUI3. The target app implements the x-launch-results protocol and correctly gets launched when doing Start > Run x-launch-results:moo?prompt=kittens ... The LaunchUriForResults, however, does not work - the Launch returns immediately with Success but no Result property.

Digging into this on my own now, stay tuned.