Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to register a protocol handler in C#
internal static class ChromeLauncher
{
private const string ChromeAppKey = @"\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe";
private static string ChromeAppFileName
{
get
{
return (string) (Registry.GetValue("HKEY_LOCAL_MACHINE" + ChromeAppKey, "", null) ??
Registry.GetValue("HKEY_CURRENT_USER" + ChromeAppKey, "", null));
}
}
public static void OpenLink(string url)
{
string chromeAppFileName = ChromeAppFileName;
if (string.IsNullOrEmpty(chromeAppFileName))
{
throw new Exception("Could not find chrome.exe!");
}
Process.Start(chromeAppFileName, url);
}
}
@fredrikhaglund

This comment has been minimized.

Copy link
Owner Author

@fredrikhaglund fredrikhaglund commented Jun 20, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment