Search code examples
c#winformsuwp

Can I somehow call the UWP launcher from a Windows Forms Application?


I would like to open the Windows settings with the launcher. It is a one-liner in UWP. Docu: https://learn.microsoft.com/en-us/windows/uwp/launch-resume/launch-settings-app

bool result = await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-webcam"));

How can I do this from a Windows Form application?

An answer of How to open display settings in Windows 10(Pogrammatically, specifically using C#)? points out to use Process, but this only seems to work under Win10, not with Win11 anymore.: https://stackoverflow.com/a/51276033/356726

Process.Start("ms-settings:display");

The RunDLL solution seems to be a workaround: https://stackoverflow.com/a/58260947/356726

But any chance to use the launcher in Win Forms?


Solution

  • Credits to emoacht, as pointed out in the comment:

    Launch settings app: https://learn.microsoft.com/en-us/windows/uwp/launch-resume/launch-settings-app

    Call Windows Runtime APIs in desktop apps: https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/desktop-to-uwp-enhance

    For me it requires at least target OS version Windows 10:

    Win OS 10