url protocol
首先注册服务
方法1,保存为reg文件直接执行,需要按需修改路径
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\EasyPrint]
"URL Protocol"="C:\\Program Files\\EasyPrint\\EasyPrint.exe"
@="EasyPrintProtocol"
[HKEY_CLASSES_ROOT\EasyPrint\DefaultIcon]
@="C:\\Program Files\\EasyPrint\\EasyPrint.exe,1"
[HKEY_CLASSES_ROOT\EasyPrint\shell]
[HKEY_CLASSES_ROOT\EasyPrint\shell\open]
[HKEY_CLASSES_ROOT\EasyPrint\shell\open\command]
@="\"C:\\Program Files\\EasyPrint\\EasyPrint.exe\" \"%1\""
方法2,在程序中自动注册服务,此操作可以放到安装程序中,根据实际情况获取path即可
var path = "E:\\code\\EasyPrint\\EasyPrint\\bin\\Debug";
List<string> cmds =
new List<string>{
"/c" + $"reg add \"HKCR\\EasyPrint\" /f /ve /d \"EasyPrintProtocol\"",
"/c" + $"reg add \"HKCR\\EasyPrint\" /f /v \"URL Protocol\" /d \"",
"/c" + $"reg add \"HKCR\\EasyPrint\\DefaultIcon\" /f /ve /d \""+path+"\\EasyPrint.exe,1\"",
"/c" + $"reg add \"HKCR\\EasyPrint\\shell\\open\\command\" /f /ve /d \"\\\""+path+"\\EasyPrint.exe\\\" \\\"%1\\\"\""
};
foreach (var command in cmds)
{
Process p = new Process
{
StartInfo =
{
FileName = "cmd.exe",
Arguments = command,
UseShellExecute = false,
RedirectStandardInput = true,
RedirectStandardOutput = true,
CreateNoWindow = true
}
};
p.Start();
p.StandardInput.WriteLine("exit");
p.Close();
}
将会在系统中注册一个协议,此协议名称根据注册表的key决定,此处为EasyPrint,大小写无关
调用时即使用 EasyPrint://par1&par2
具体参数传递方式根据需要自行处理即可,系统会将完整请求自动转发给注册的程序
url protocol的更多相关文章
- 学习笔记:URL Protocol在浏览器中打开本地应用程序
看到阿里的网站上可以通过点击卖家的旺旺图标从而调用本地的阿里旺旺程序,而且还可以传递当前浏览者需要咨询的商品.这是怎么实现的呢?是通过URLProtocol来完成. 原理还没有太清楚,即在系统里注册一 ...
- Java魔法堂:URI、URL(含URL Protocol Handler)和URN
一.前言 过去一直搞不清什么是URI什么是URL,现在是时候好好弄清楚它们了!本文作为学习笔记,以便日后查询,若有纰漏请大家指正! 二.从URI说起 1. 概念 URI(Uniform Reso ...
- Js调用exe程序方法(通过URL Protocol实现网页调用本地应用程序)
1.使用记事本(或其他文本编辑器)创建一个protocal.reg文件,并写入以下内容 Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROO ...
- 利用URL protocol在网页打开本地exe
Registering the Application Handling the Custom URI Scheme To register an application to handle a pa ...
- 自定义URL Protocol 协议
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\fuck] @="fuck Protocol" "URL ...
- 【C#】 URL Protocol
[C#] URL Protocol 网页调用本地程序, 支持 Windows 下所有浏览器, 与浏览器插件对比实现简单,但判断是否调用成功时, 只有ie10以上有函数,其他浏览器得自己实现(用 ifr ...
- chrome url protocol 提示配置文件路径
%localappdata%\Google\Chrome\User Data\Default\Preferences 搜索对应的协议名,例如:{"x-github-client": ...
- 检查URL Protocol是否安装的项目
https://github.com/ismailhabib/custom-protocol-detection
- 利用URL Protocol实现网页调用本地应用程序
http://blog.csdn.net/zssureqh/article/details/25828683
随机推荐
- 第六章· MySQL索引管理及执行计划
一.索引介绍 1.什么是索引 1)索引就好比一本书的目录,它能让你更快的找到自己想要的内容. 2)让获取的数据更有目的性,从而提高数据库检索数据的性能. 2.索引类型介绍 1)BTREE:B+树索引 ...
- 8.Netty发送对象
1.Netty发送对象简介: Netty中,通讯的双方建立连接后,会把数据按照ByteBuf的方式进行传输,例如http协议中,就是通过HttpRequestDecoder对 ByteBuf数 据流进 ...
- Selenium(2)
testing123456peter123456rose123456 一.常见的运行错误: 1.[error] Timed out after 30000ms Timed out:超时 after:之 ...
- idea中添加mybatis mapper 样例
代码: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC &quo ...
- NIM 1
博弈论(一):Nim游戏 重点结论:对于一个Nim游戏的局面(a1,a2,...,an),它是P-position当且仅当a1^a2^...^an=0,其中^表示位异或(xor)运算. Nim游戏是博 ...
- PAT乙级1013
题目链接 https://pintia.cn/problem-sets/994805260223102976/problems/994805309963354112 题解一 从第一个素数开始找起,输出 ...
- python读取csv文件的某一列或某几列
import csvimport pandas as pd with open('D:\Data\新建文件夹\list3.2.csv','r') as csvfile: reader = csv.re ...
- IDEA中使用Sqlite3
去maven下载驱动包 ( jar包 ) 下载地址:http://mvnrepository.com/artifact/org.xerial/sqlite-jdbc/3.23.1 打开IDEA 创建 ...
- kafka的maxPollIntervalMs设置太小引发的惨案 (转)
本地启动kafka后,不断报一下信息: 表示本地consumer节点在不断的重新加入group,并且不断伴随着offset commit失败. 具体原因是因为ConsumerCoordinator没有 ...
- vue项目,百度地图api高亮选取区域,高亮某个地区,行政区域等
效果如下: var blist = [] ,maxZoom: });// 创建地图实例 var point = new window.BMap.Point(89.48,31.57); map.cent ...