zoukankan      html  css  js  c++  java
  • 注册Jmail组件的三种方法

    1、在命令行下执行:
        cmd
        regsvr32 jmail.dll

    2、在安装程序中:
     public override void Install(System.Collections.IDictionary stateSaver)
      { 
       base.Install(stateSaver);
       try
       {
        /*
        在制作安装包时,自定义操作->安装,添加自定义操作(来自XX安装程序的主输出),配置
    CustomerActionData=/targetdir="[TARGETDIR]\"
        */  

        string targetdir=this.Context.Parameters["targetdir"].Trim();
        if(!targetdir.EndsWith(@"\"))
            targetdir+=@"\";
       
       //注册Jmail组件
        try
        {
         JmailReg(targetdir);
        }
        catch(Exception)
        { }
        
       }
       catch(Exception ex)
       {
        throw ex;
       }
     }

    3、在Windows应用程序中:
    private void DoUpdate()
      {
       string strPath=Application.StartupPath;
       IniFile ini = new IniFile(strPath+@"\sys.ini");
       //注册Jmail
       if(ini.IniReadValue("System","JmailReg").ToString()!="1")
       {
        JmailReg(strPath);
        ini.IniWriteValue("System","JmailReg","1");
       }
     }

    private void JmailReg(string targetdir)
      {
       try
       {
        ProcessStartInfo processInfo =new ProcessStartInfo("regsvr32");
        //processInfo.WindowStyle=ProcessWindowStyle.Normal;
        
    processInfo.WindowStyle=ProcessWindowStyle.Hidden;
        processInfo.Arguments=" /s "+ Char.ToString('"') + targetdir + "jmail.dll"+Char.ToString('"');      
        Process osql = Process.Start(processInfo);
        //Wait till it is done...
        osql.WaitForExit();
        osql.Dispose();
        processInfo=null;
       }
       catch(Exception)
       {}
      }

  • 相关阅读:
    v-bind绑定属性
    vue 第二次学习笔记 v-once v-html
    P4428-[BJOI2018]二进制【树状数组,set】
    P5180-[模板]支配树
    《架构之美》阅读笔记一
    Python基础04----条件控制
    Tensorflow2.0笔记33——Keras 来搭建神经网络的“八股”套路
    每周总结
    架构漫谈阅读笔记01
    Tensorflow2.0笔记32——卷积神经网络
  • 原文地址:https://www.cnblogs.com/huazai8204/p/1029992.html
Copyright © 2011-2022 走看看