zoukankan      html  css  js  c++  java
  • 从web启动winform程序

    最近有个客户提出想从网站上启动一个客户端的程序,研究了下,实现方法如下:

    1. 注入注册表

          try
                    {
                        string appPath = """ + Application.ExecutablePath + "" "%1"";
                        string strKey = Application.ProductName;
                        string strKey_shell_open_cmd = strKey + @"shellopencommand";
                        var subKey = Registry.ClassesRoot.CreateSubKey(strKey);
                        subKey.SetValue("URL Protocol", "1");
                        var subKey_shell_open_cmd = Registry.ClassesRoot.CreateSubKey(strKey_shell_open_cmd);
                        subKey_shell_open_cmd.SetValue(null, appPath);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(string.Format("Web启动参数设置失败, 原因: {0}", ex.Message));
                    }

    注入后效果如下图:

    image

    %1是传入的参数

    2. 网站上加一个link

    <a href="HelloWorld://123">Hello World</a>

    这里123是传入的参数

    image

    当我们点击这个link时,就会自动打开这个客户端软件。

  • 相关阅读:
    python的IDE(pycharm)安装以及简单配置
    python环境搭建(python2和python3共存)
    如何搭建samba服务?
    css 样式 文字过长 换行处理方法
    my97 日历控件
    myeclipse8.6 注册码
    (46) odoo核心文档分享
    (01-02) odoo8.0_Ubuntu14.04_nginx反代理设置
    (45) Manifest文件
    (44) odoo中的WebService
  • 原文地址:https://www.cnblogs.com/fengwenit/p/4099227.html
Copyright © 2011-2022 走看看