MicrosoftDocs / winrt-api

WinRT reference content for developing Microsoft Universal Windows Platform (UWP) apps
Creative Commons Attribution 4.0 International
227 stars 495 forks source link

Using UWP Windows.System.Launcher from desktop apps is under-documented #1107

Closed metathinker closed 1 week ago

metathinker commented 5 years ago

Since Windows 10 version 1903 (19H1), some of the static methods in the Windows.System.Launcher class have been callable from a Windows classic/desktop application.

To do this, you need to do the following:

  1. Call a Launcher method that takes a LauncherOptions object as a secondary parameter. (I believe that all such methods of Launcher will work for desktop apps, but I am unsure.)
  2. After creating the LauncherOptions object but before passing it to Launcher, use IUnknown::QueryInterface() to get a reference to the object as an IInitializeWithWindow, and then call Initialize(hwnd) with the HWND of an appropriate owner window.

Unfortunately, the only mention of any part of this procedure, or that Launcher is even usable from desktop apps, is on the below-linked page for the LauncherOptions constructor.

I don't think this is sufficient because:

To fix this gap, I would suggest that Launcher's doc pages be revised to mention that Launcher can be used from desktop apps using the above procedure, and as an extra hint, LauncherOptions' main doc page should be revised to say that LauncherOptions implements IInitializeWithWindow and that can be used to allow Launcher to be used from desktop apps.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

HO-COOH commented 1 month ago

Please, this needs to be addressed, or people get wasting time using WinUI 3.

alvinashcraft commented 1 week ago

Thanks for taking the time to let us know about this and we sincerely apologize for the delayed response. There was information added to these docs in March 2022 about calling from desktop apps, with a link added for more info and examples. If you believe your feedback is still actionable, let us know either directly in this thread or by filing a new Issue and we’ll work to incorporate the suggestions into the documentation. Though the Issue will be marked as Closed, we will monitor any replies that come afterwards so feel free to treat this like an open Issue. Many thanks!

HO-COOH commented 1 week ago

@alvinashcraft Just see the issue. The documentation is vague about

To access this page with a URI, use the ms-settings:appsfeatures-app URI and pass an optional parameter of the package family name of the app.

And nothing with that "optional parameter" we have tried so far worked