WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

Implement Launcher::LaunchUriForResultsAsync for desktop apps

Open jaigak opened this issue 4 years ago • 2 comments

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).

jaigak avatar Dec 29 '21 13:12 jaigak

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

saul-mtz avatar Feb 09 '22 02:02 saul-mtz

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.

jonwis avatar Apr 05 '24 21:04 jonwis