chrome网页中打开exe

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOTVMS]
@="URL:VMS"
"URL Protocol"=""

[HKEY_CLASSES_ROOTVMSDefaultIcon]
@="chrome.exe,1"

[HKEY_CLASSES_ROOTVMSshell]

[HKEY_CLASSES_ROOTVMSshellopen]

[HKEY_CLASSES_ROOTVMSshellopencommand]
@="E:\Debug\CameraPlayer.exe  %1"

以上内容另存为WebCall.reg,替换最后一行为实际要打开的exe文件全路径  最后的%1代表参数

双击导入注册表

网页中加入

<a href="VMS://uuid,admin,张三"> vms </a>

浏览网页 点击超链接即可打开exe

程序中接受传递的值

Main函数中

MessageBox.Show(e.Args.Length + "|" );

if (e.Args.Length > 0)
{
string arg = e.Args[0];

string para = arg.Substring(arg.IndexOf(":")+1, arg.Length- arg.IndexOf(":") -1);
string[] params= para.Split(',');

}

From:https://www.cnblogs.com/xuejianxiyang/p/10828106.html

原文地址:https://www.cnblogs.com/xuejianxiyang/p/10828106.html