I have a small project to handle tel:
protocol links. It's a desktop application, which I'm developing using Visual Studio 2013 Community Edition.
Previously, I used to register the handler with a simple registry modification:
Microsoft.Win32.Registry.SetValue(registryKey, string.Empty, registryValue, Microsoft.Win32.RegistryValueKind.String);
Microsoft.Win32.Registry.SetValue(registryKey, "URL Protocol", String.Empty, Microsoft.Win32.RegistryValueKind.String);
registryKey = @"HKEY_CLASSES_ROOT\tel\shell\open\command";
registryValue = "\"" + AppDomain.CurrentDomain.BaseDirectory + "TelProtocolHandler.exe\" \"%1\"";
Microsoft.Win32.Registry.SetValue(registryKey, string.Empty, registryValue, Microsoft.Win32.RegistryValueKind.String);
However, this no longer seems to work on Windows 8. While the registry key has the desired value, the links are still handled by a different application. My tool doesn't even appear in the protocol handler selection:
I've looked at Walkthrough: Using Windows 8 Custom Protocol Activation, but I can't relate the mentioned information to my application. The article mentions a .appxmanifest
file, which I don't have in my project and am unable to add as a new item.
After asking the question, I stumbled upon Registering a protocol handler in Windows 8
The top voted answer there got me on the right track, although there were other issues. In the end, this is what I ended up with:
TelProtocolHandler
is the name of my application and should be replaced by whatever the name of your handler is.The accepted answer in the other question also has
ApplicationDescription
in the registry. I didn't see the same key for any of the other registered handlers that I've checked, so I left it out and couldn't detect any problems.Another key issue was that all of this wouldn't work if my application that sets up the handler was 32bit. When the entries are made in the Wow6432Node, I wasn't able to select the handler as the default for the given protocol. It took me a while to figure this out, because my application was compiled as AnyCPU. What I first missed was this little flag in the project properties: