美文网首页
exe程序打包写入注册表URL启动

exe程序打包写入注册表URL启动

作者: a9b854aded01 | 来源:发表于2018-09-26 09:48 被阅读0次

    exe 打包工具VNIS将变异文件打包成一个安装文件

    URL Protocal协议模板

    Windows Registry Editor Version 5.00
    
    
    [HKEY_CLASSES_ROOT\myprotocol]
    
    @="myprotocol Protocol"
    
    "URL Protocol"=""
    
    
    [HKEY_CLASSES_ROOT\myprotocol\DefaultIcon]
    
    @="D:\\CloudMusic\\cloudmusic.exe"
    
    
    [HKEY_CLASSES_ROOT\myprotocol\shell]
    
    @=""
    
    
    [HKEY_CLASSES_ROOT\myprotocol\shell\open]
    
    @=""
    
    
    [HKEY_CLASSES_ROOT\myprotocol\shell\open\command]
    
    @="\"D:\\CloudMusic\\cloudmusic.exe\" "
    

    对应打包时的脚本

        WriteRegStr HKCR "myprotocol" "" "myprotocol Protocol"
        WriteRegStr HKCR "myprotocol" "URL Protocol" ""
        WriteRegStr HKCR "myprotocol\DefaultIcon" "" "$INSTDIR\GFF客户端.exe"
        WriteRegStr HKCR "myprotocol\shell" "" ""
        WriteRegStr HKCR "myprotocol\shell\open" "" ""
      WriteRegStr HKCR "myprotocol\shell\open\command" "" '"$INSTDIR\GFF客户端.exe" "%1"'
    

    安装完成后注册表


    TIM图片20180926094320.png

    html url

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     
     <head>
         
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      
    </head>
       
     <body>
           
     <div>
               
     <a href="myprotocol://123,123,123">
    
     执行可执行文件
      </a>
            
    </div>
        
    </body>
    
    </html>
    
    

    程序入口接收url参数

      private static void Main(string[] args)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                if(args.Length >0)
                {
                    for(int i =0; i< args.Length; i++)
                    MessageBox.Show(args[i].ToString());
                }
    

    通过url protocal 传参启动本地exe


    TIM图片20180926094752.png

    相关文章

      网友评论

          本文标题:exe程序打包写入注册表URL启动

          本文链接:https://www.haomeiwen.com/subject/hxqdoftx.html