当前位置:网站首页>URL Protocol web page to open the application
URL Protocol web page to open the application
2022-08-09 22:07:00 【Calm Nine】
URL Protocol
Introduction
Sometimes when developing web pages, you will encounter a function that needs to open a computer-specific program. At this time, you need to use URL Protocol.
The general idea is to first register a custom URL Protocol for the application, and then use the URL Protocol to implement the web page to call the application.
1, add registry
Customize a registry file, similar to Protocol.reg, add the following
Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\MyWinform]@="URL:MyWinform Protocol Handler""URL Protocol"=""[HKEY_CLASSES_ROOT\MyWinform\DefaultIcon]@="F:\\AllProjects\\VisualStudio\\TestWinform\\MyWinform\\MyWinform\\bin\\Debug\\MyWinform.exe"[HKEY_CLASSES_ROOT\MyWinform\shell][HKEY_CLASSES_ROOT\MyWinform\shell\open][HKEY_CLASSES_ROOT\MyWinform\shell\open\command]@="\"F:\\AllProjects\\VisualStudio\\TestWinform\\MyWinform\\MyWinform\\bin\\Debug\\MyWinform.exe\" \"%1\"""MyWinform" in the file is my custom program name, which can be changed to my own application name. Note that the path is double slashes.
2. Writing web pages
Write a simple web page here, which is mainly a hyperlink. The "MyWinform" at the beginning is the user-defined program name, and parameters can be passed later.
Click me to try it
Effects

3. Parameter reception
Here only describes how to accept parameters under Winform, others can study by themselves.
/// /// The main entry point for the application./// [STAThread]static void Main(string[] args){string inputArgs = string.Join(",", args);if (AnotherAppIsRunning()){MessageBox.Show("A program is already running: " + inputArgs);}else{MessageBox.Show(inputArgs);Console.WriteLine(inputArgs);Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Application.Run(new Form1());Console.WriteLine("The game is officially started!!!!");}}Rendering

Summary
There are also some ways to add registry in C# script, but it requires administrator privileges. If necessary, you can learn about the RegistryKey class.
边栏推荐
- 纸业供应链协同管理系统:重构纸业智慧供应网络,支撑企业数字化转型升级
- [Free column] Xposed plug-in development for Android security [from scratch] tutorial
- Prometheus Operator 自定义监控添加redis explorer
- Js查找字符串中出现最多次数的字母和单词
- Abbkine TraKine Pro 活细胞微管染色试剂盒重要特色
- How are data integration APIs key to enterprise digital transformation?
- Redis 大的情况下,key 要如何处理?
- [Free column] APK dynamic reverse application of Android security [Three Smali injection methods]
- tki-tree 树组件控制默认展开第几层数据
- What are the benefits of enterprise data integration?How do different industries solve the problem of data access?
猜你喜欢
随机推荐
Toronto Research Chemicals加米霉素-d4说明书
MySQL笔记-06 基础SQL操作
Prometheus Operator 自定义监控添加redis explorer
倍福CX5120实现温度控制例程详细解析
面试官:Redis 大 key 要如何处理?
漏洞复现-redis未授权getshell
buuctf (Adventure 2)
What are the benefits of enterprise data integration?How do different industries solve the problem of data access?
华为云创新中心助力启泰智能 补齐中小模具企业数字化能力短板
axi4c
How to deal with keys when Redis is large?
【分享】入驻集简云开发者平台,如何使用Session Auth配置授权?
明明加了唯一索引,为什么还是产生重复数据?
DP-Differential Privacy概念介绍
win10配置CenterNet环境
mysql 重复数据 分组 多条最新的记录
visual studio 2022调试技巧介绍
鲜花线上销售管理系统的设计与实现
URL Protocol 网页打开应用程序
移动端,PC端,微信等常用平台和浏览器判断









