自定义协议从浏览器中启动本地应用程序
其中注册表信息
Test.Reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Test]
@="TestProtocol"
"URLProtocol"=""
[HKEY_CLASSES_ROOT\Test\DefaultIcon]
@="F:\\Test.exe,1"
[HKEY_CLASSES_ROOT\Test\shell]
[HKEY_CLASSES_ROOT\Test\shell\open]
[HKEY_CLASSES_ROOT\Test\shell\open\command]
@="\"F:\\Test.exe\" \"%1\""
本地应用程序
class Program
{
static void Main(string[] args)
{
if (args == null || args.Length == 0)
{
Console.WriteLine(" 没有获取到任何信息 !");
}
else
{
Console.WriteLine(string.Join(",", args));
}
Console.ReadLine();
}
}
index.htm
<!DOCTYPEHTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type"content="text/html; charset=utf-8" />
</head>
<body>
<div>
<a href="Test://message/?uin=88888888&Site=JooIT.com&Menu=yes">
打开客户端软件
</a>
</div>
</body>
</html>
实现的效果。