zoukankan      html  css  js  c++  java
  • 注册和卸载COM

    /// <summary>
           
    /// 注册COM+
           
    /// </summary>
           
    /// <param name="assembly"></param>
           
    /// <param name="strErrorMessage"></param>
           
    /// <returns></returns>
           public static bool Install(string assembly, ref string strErrorMessage)
           {
               bool flag = true;
               string applicationName = string.Empty;
               string typeLibraryName = string.Empty;
               try
               {
                   flag = true;
                   RegistrationHelper helper = new RegistrationHelper();
                   helper.InstallAssembly(assembly, ref applicationName, ref typeLibraryName, InstallationFlags.CreateTargetApplication);
                   strErrorMessage = string.Empty;
               }
               catch (Exception ex)
               {
                   flag = false;
                   strErrorMessage = ex.Message;
                   //throw;
               }
               return flag;
           }


           /// <summary>
           
    /// 卸栽COM+
           
    /// </summary>
           
    /// <param name="assembly"></param>
           
    /// <param name="strErrorMessage"></param>
           
    /// <returns></returns>
           public static bool UnInstall(string assembly, ref string strErrorMessage)
           {
               bool flag = true;
               string applicationName = string.Empty;
               string typeLibraryName = string.Empty;
               try
               {
                   flag = true;
                   RegistrationHelper helper = new RegistrationHelper();
                   helper.UninstallAssembly(assembly,  applicationName,  typeLibraryName);
                   strErrorMessage = string.Empty;
               }
               catch (Exception ex)
               {
                   flag = false;
                   strErrorMessage = ex.Message;
                   //throw;
               }
               return flag;
           }
        } 

      
  • 相关阅读:
    [华为oj]放苹果
    [华为oj]iNOC产品部-杨辉三角的变形
    值传递和引用传递
    Struts2+Jquery+Json集成
    使用堆栈结构进行字符串表达式("7*2-5*3-3+6/3")的计算
    使用环形链表解决约瑟夫(丢手帕)问题
    tomcat配置数据源
    ORA-01652:无法通过128(在表空间TEMP中)扩展temp段
    (转)Java 代码优化过程的实例介绍
    (转)走进JVM,浅水也能捉鱼
  • 原文地址:https://www.cnblogs.com/51net/p/2537872.html
Copyright © 2011-2022 走看看