Assotiate with URL protocol

344 views Asked by At

In our desktop app we associate it with URL protocol using the registry. We write to this key:

HKEY_CURRENT_USER\Software\Classes

For example, to associate our app with magnet: links we use the following code:

    QSettings settings("HKEY_CURRENT_USER\\Software\\Classes", QSettings::NativeFormat);    
    settings.setValue("magnet/Default", "URL:Magnet link");
    settings.setValue("magnet/Content Type", "application/x-magnet");
    settings.setValue("magnet/URL Protocol", "");
    settings.setValue("magnet/DefaultIcon/Default", QDir::toNativeSeparators(icon_str));
    settings.setValue("magnet/shell/Default", "open");
    settings.setValue("magnet/shell/open/command/Default", QDir::toNativeSeparators(command_str));

Once we execute this code, browsers are able to launch our app when the user clicks on a magnet: link.

Is this possible for our app being converted using Desktop App Converter?

1

There are 1 answers

0
Stefan Wick  MSFT On BEST ANSWER

Converted desktop-bridge apps declare their protocol association in the appxmanifest, not the registry:

https://learn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-extensions#protocol