• 注册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)
       {}
      }

  • 相关阅读:
    Python File readline() 方法
    Python File read() 方法
    Python File next() 方法
    Python File isatty() 方法
    POJ 3281 Dining(最大流板子)
    poj 3436 ACM Computer Factory 最大流+记录路径
    HDU2732 Leapin' Lizards 最大流
    线段覆盖、区间选点、区间覆盖贪心讲解
    顺序表完成教师职称管理系统
    c++派生类中构造函数和析构函数执行顺序、判断对象类型、抽象类、虚函数
  • 原文地址:https://www.cnblogs.com/huazai8204/p/1029992.html
Copyright © 2020-2023  润新知